flask-dance
flask-dance copied to clipboard
logout example is not working as blueprint's token is None
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.
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?
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?