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

logout example is not working as blueprint's token is None #323

Open
manosetro opened this issue Sep 20, 2020 · 2 comments
Open

logout example is not working as blueprint's token is None #323

manosetro opened this issue Sep 20, 2020 · 2 comments

Comments

@manosetro
Copy link

manosetro commented Sep 20, 2020

I am trying to implement a logout functionality with revoke enabled, for facebook and I am following this example: https://flask-dance.readthedocs.io/en/latest/logout.html

The problem is that s the token is None in this line:
token = blueprint.token["access_token"]

I followed this example for storing oauth objets.

I found a similar question here for google.

@singingwolfboy
Copy link
Owner

If blueprint.token is None, that indicates that there is no OAuth token in the token storage system. Generally, this indicates that there is no saved token to revoke. If you have this issue, it might indicate that you don't have a logged in user in the first place -- it doesn't make sense to logout if you're not logged in!

Does that help?

@manosetro
Copy link
Author

The issue is that there is a token in the storage, associated with the logged in user.

My guess is that in this code, the facebook_logged_in function (annotated with @oauth_authorized.connect_via), does not update the blueprint with the retrieved token. The token is stored in the backend storage, but cannot be accessed through the blueprint.

I suppose that that last line

# Disable Flask-Dance's default behavior for saving the OAuth token
return False

causes the problem, as something of the default behavior is missing. Does that I am saying make sense?

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

2 participants