Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token-related TypeError #45

Open
Frostbyte0x70 opened this issue Oct 21, 2024 · 0 comments
Open

Token-related TypeError #45

Frostbyte0x70 opened this issue Oct 21, 2024 · 0 comments

Comments

@Frostbyte0x70
Copy link
Member

I don't have a proper dev environment set up and the documentation for Requests-OAuthlib is pretty lacking, so I'll just dump the stacktrace here in case I ever feel like looking into this.

TypeError: Expected bytes, unicode, or None; got <class 'oauthlib.oauth2.rfc6749.tokens.OAuth2Token'>

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/requests_oauthlib/oauth2_session.py", line 528, in request
    url, headers, data = self._client.add_token(
  File "/usr/local/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 217, in add_token
    raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/swablu/web.py", line 94, in get
    if await self.auth(self._allow_auth_without_hacks):
  File "/app/swablu/web.py", line 166, in auth
    user = discord.get(API_BASE_URL + '/users/@me').json()
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests_oauthlib/oauth2_session.py", line 554, in request
    self.token_updater(token)
  File "/app/swablu/web.py", line 113, in token_updater
    self.set_cookie('oauth2_token', token)
  File "/usr/local/lib/python3.9/site-packages/tornado/web.py", line 635, in set_cookie
    value = escape.native_str(value)
  File "/usr/local/lib/python3.9/site-packages/tornado/escape.py", line 228, in to_unicode
    raise TypeError("Expected bytes, unicode, or None; got %r" % type(value))
TypeError: Expected bytes, unicode, or None; got <class 'oauthlib.oauth2.rfc6749.tokens.OAuth2Token'>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant