android - oauth2 : Android authentication against spring boot

标签 android spring-boot oauth-2.0

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

我认为流程应该是:

  1. Android 应用获取 oauth token

  2. Android 应用将此 token 作为请求属性传递给 spring boot 应用

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

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

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

我的问题是:

  1. 这是正确的吗?

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

最佳答案

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

为了让它工作,我需要做两件事:

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

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

关于android - oauth2 : Android authentication against spring boot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43883157/

相关文章:

android - 动态修改布局比静态布局

java - DBUnit 和 Spring Boot - 在集成测试中请求时可能无法导入或不存在数据

javascript - Google Maps API - 透明传递地址组件

oauth-2.0 - 使用承载 token 的MVC 5 Identity 2和Web API 2授权和调用api

php - 从 Google OAuth 2.0 PHP API 获取用户信息

c# - 如何生成 OAuth 客户端标识符和客户端密码?

android - KeyBoardAvoidingView 隐藏内容

android - 在 Motorola Atrix Android Gingerbread 的 qHD 屏幕上出现缩小的示例软键盘

java - 如何针对这种情况配置HttpSecurity(Spring Boot)

java - Mockito:模拟一个操作输入数组参数的方法