【问题标题】:Authenticated Requests in OAuth JavaOAuth Java 中的经过身份验证的请求
【发布时间】:2013-03-31 22:58:43
【问题描述】:

如果有人有使用http://oauth.googlecode.com/svn/code/java/core/ 和此代码中的示例服务器的经验,也许您可​​以向我解释一下 Authenticated Requests 处理是如何实现的? 参考:https://www.rfc-editor.org/rfc/rfc5849#section-3

因此,当用户通过身份验证并且受保护的资源服务器只想向 OAuth 提供者确认其真实性时。

【问题讨论】:

    标签: java authentication oauth request


    【解决方案1】:

    从 Google API 控制台创建一个新项目并获取客户端 ID 和密钥。 https://code.google.com/apis/console

    按照此示例 https://code.google.com/p/google-api-java-client/wiki/OAuth2Draft10 帮助开发适用于 Google 的 OAUTH 客户端插件。

    确保您已根据需要更改范围、回调 URL 和缩短 URL 等。

    private static final String SCOPE = "https://www.googleapis.com/auth/urlshortener";
    private static final String CALLBACK_URL = "urn:ietf:wg:oauth:2.0:oob";
    ...
    
    
    GenericUrl shortenEndpoint = new GenericUrl("https://www.googleapis.com/urlshortener/v1/url");
    

    此页面将帮助您了解身份验证和授权流程https://developers.google.com/accounts/docs/OAuth2

    对 Google OAUTH 有帮助

    OAuth 2.0 Playground
    

    很棒的游乐场。这将使您的应用程序进行 OAuth 并获得您想要的信息。换句话说,您可以看到您的应用程序将如何为 OAUTH 运行,以及为 Google 编写 OAUTH 代码需要哪些信息。 https://developers.google.com/oauthplayground/

    Verify Access Token
    

    通过此 URL https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=验证您的访问令牌***

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-02
      • 2019-03-29
      • 2021-05-01
      • 1970-01-01
      相关资源
      最近更新 更多