How to Log User out of an App that uses Google OAuth2 Sign-In?

本秂侑毒 提交于 2019-12-02 01:24:45

You can refer the following link to revoke() the token assigned to your App. This will logout user from your app, but he will remain signed into google. Its mentioned on same link you have mentioned in your post above.

https://developers.google.com/identity/protocols/OAuth2WebServer#tokenrevoke

user3053186

The trick is to add prompt='consent'. There are different places to add it depending on the API's you are using. Here is one example based on bookshelf app:

from oauth2client.contrib.flask_util import UserOAuth2
oauth2 = UserOAuth2()
oauth2.init_app(
    app,
    scopes=['email', 'profile'],
    authorize_callback=_request_user_info,
    client_id=app.config['GOOGLE_OAUTH2_CLIENT_ID'],
    client_secret=app.config['GOOGLE_OAUTH2_CLIENT_SECRET'],
    prompt='consent'
)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!