weibeu / Flask-Discord

Discord OAuth2 extension for Flask. An Easier implementation of "Log In With Discord".
https://flask-discord.readthedocs.io/en/latest/
MIT License
183 stars 47 forks source link

How does one get the user ID if they are overriding save_authorization_token? #50

Closed FM1337 closed 3 years ago

FM1337 commented 3 years ago

I'm trying to handle token storing server side, I nearly got everything working but I need to have access to the user's ID but I cannot seem to obtain it using the fetch_user() method, even if I set the token in session momentarily before calling it. What magic can I do to get around this issue?

jnawk commented 3 years ago

why not just use a session driver that doesn't write the content of the session to a cookie?

FM1337 commented 3 years ago

why not just use a session driver that doesn't write the content of the session to a cookie?

So using something like https://flask-session.readthedocs.io/en/latest/ is what you're suggesting?

jnawk commented 3 years ago

why not just use a session driver that doesn't write the content of the session to a cookie?

So using something like https://flask-session.readthedocs.io/en/latest/ is what you're suggesting?

yes exactly. you'll need to pick a backend, your choice will be guided by what scale your app runs at - a single server, you could use memory or disk, multiple servers, you'll want to use a database or cache

FM1337 commented 3 years ago

why not just use a session driver that doesn't write the content of the session to a cookie?

So using something like https://flask-session.readthedocs.io/en/latest/ is what you're suggesting?

yes exactly. you'll need to pick a backend, your choice will be guided by what scale your app runs at - a single server, you could use memory or disk, multiple servers, you'll want to use a database or cache

Thanks, got it working