我有一个安卓应用程序。我正在尝试使用 oauth2 登录我的用户,并提供对我的服务器的访问权限。服务器是使用spring boot编写的。我使用谷歌作为我的社交身份验证。
我认为流程应该是:
Android 应用获取 oauth token
Android 应用将此 token 作为请求属性传递给 spring boot 应用
Spring boot 获取 token 并对其进行验证。
我已通过以下操作成功完成 (1): https://developer.android.com/training/id-auth/authenticate.html
(2) 很简单(上面链接中的示例)
我的问题是:
这是正确的吗?
我在哪里使用 spring boot 配置我的 api key ?
最佳答案
所以这个流程是正确的,或者至少对我有用。
为了让它工作,我需要做两件事:
将示例中的 Authorization header 的值从 OAuth 更改为 Bearer
添加来自其他帖子的过滤器:Spring Security OAuth2 - @EnableOauth2Sso but accept tokens as authentication, too
关于android - oauth2 : Android authentication against spring boot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43883157/