【问题标题】:oauth2: Android authentication against spring bootoauth2:针对 Spring Boot 的 Android 身份验证
【发布时间】:2017-10-08 13:15:09
【问题描述】:

我有一个安卓应用程序。我正在尝试使用 oauth2 登录我的用户,并提供对我的服务器的访问权限。服务器是使用 spring boot 编写的。我使用 google 作为我的社交身份验证。

我认为流程应该是:

  1. Android 应用获取 oauth 令牌

  2. Android 应用将此令牌作为请求属性传递给 Spring Boot 应用

  3. Spring boot 获取令牌并对其进行验证。

我已通过以下方式成功完成 (1): https://developer.android.com/training/id-auth/authenticate.html

(2) 很简单(上面链接中的示例)

我的问题是:

  1. 这是正确的吗?

  2. 在哪里配置我的 api key 与 spring boot?

【问题讨论】:

  • 所以看起来我误解的一件事是 android 中的 AccountManager 返回 JWT 令牌而不是 OAuth 令牌

标签: android spring-boot oauth-2.0


【解决方案1】:

所以这个流程是正确的,或者至少对我有用。

要完成这项工作,我需要做两件事:

  1. 将示例中 Authorization 标头的值从 OAuth 更改为 Bearer

  2. 从其他帖子添加过滤器:Spring Security OAuth2 - @EnableOauth2Sso but accept tokens as authentication, too

【讨论】:

    猜你喜欢
    • 2020-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-25
    • 1970-01-01
    • 2020-10-29
    • 1970-01-01
    相关资源
    最近更新 更多