我正在使用 Google OAuth 对我的 GAE 应用程序中的用户进行身份验证。用户单击“授予访问权限”后,我想返回到我的应用程序。我尝试设置回调 URL,但它不是独立调用,而是附加到浏览器中的当前 URL,因此显示为无效 URL。
这是我的代码:
OAuthGetTemporaryToken requestToken = new OAuthGetTemporaryToken(REQUEST_TOKEN_URL);
requestToken.consumerKey = CONSUMER_KEY;
requestToken.transport = TRANSPORT;
requestToken.signer = signer;
requestToken.callback="www.mail.yahoo.com";
OAuthCredentialsResponse requestTokenResponse = requestToken.execute();
// updates signer's token shared secret
signer.tokenSharedSecret = requestTokenResponse.tokenSecret;
OAuthAuthorizeTemporaryTokenUrl authorizeUrl = new OAuthAuthorizeTemporaryTokenUrl(AUTHORIZE_URL);
authorizeUrl.temporaryToken = requestTokenResponse.token;
此行将其发送到 Google OAuth 页面。
resp.sendRedirect(authorizeUrl.build());
我已经设置了如上所示的回调参数,但它不起作用。请帮忙!提前致谢。
最佳答案
这是 OAuth1 的东西,已被弃用。尝试改用 OAuth 2.0。从 https://developers.google.com/accounts/docs/OAuth2 开始
关于oauth - 如何为 Google OAuth 设置回调 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16293942/