如何设置Google OAuth的回调URL?

use*_*971 7 oauth callbackurl google-oauth

我正在使用 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;
Run Code Online (Sandbox Code Playgroud)

此行将其发送到 Google OAuth 页面。

resp.sendRedirect(authorizeUrl.build());
Run Code Online (Sandbox Code Playgroud)

我已经设置了回调参数,如上所示,但它不起作用。请帮忙!提前致谢。

Tim*_*ray 6

这是 OAuth1 的东西,已被弃用。尝试改用 OAuth 2.0。从https://developers.google.com/accounts/docs/OAuth2开始