如何重置谷歌oauth 2.0授权? [英] How to reset google oauth 2.0 authorization?
问题描述
我使用 Google API客户端JavaScript库(测试版)在Web应用程序上授权用户Google帐户(用于YouTube操作)。一切工作正常,但我不知道如何从应用程序注销用户,即重置访问令牌。
例如,下面的代码检查用户授权,如果不是,显示弹出窗口供用户登录并允许网络应用访问用户数据: gapi.auth.authorize( {client_id:CLIENT_ID,scope:SCOPES,immediate:false},handleAuth);
但客户端库不具有重置授权的方法。
解决方法将用户重定向到accounts.google.com/logout,但这种
方法并非我所需要的:因此我们不仅从Google帐户登录用户我的应用程序,但也在任何地方。
谷歌常见问题和客户端库的描述既没有帮助。
尝试撤销访问令牌,这应该撤销实际授予,以便自动批准将停止工作。我认为这会解决您的问题。
https:/ /developers.google.com/accounts/docs/OAuth2WebServer#tokenrevoke
I'm using Google APIs Client Library for JavaScript (Beta) to authorize user google account on web application (for youtube manipulations). Everything works fine, but i have no idea how to "logout" user from my application, i.e. reset access tokens.
For example, following code checks user authorization and if not, shows popup window for user to log into account and permit web-application access to user data:
gapi.auth.authorize({client_id: CLIENT_ID, scope: SCOPES, immediate: false}, handleAuth);
But client library doesn't have methods to reset authorization.
There is workaround to redirect user to "accounts.google.com/logout", but this approach is not that i need: thus we logging user off from google account not only from my application, but also anywhere.
Google faq and client library description neither helpful.
Try revoking an access token, that should revoke the actual grant so auto-approvals will stop working. I assume this will solve your issue.
https://developers.google.com/accounts/docs/OAuth2WebServer#tokenrevoke
这篇关于如何重置谷歌oauth 2.0授权?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!