【发布时间】:2017-01-12 22:32:37
【问题描述】:
我已使用以下 application.yml 在 iOS 上成功实现 Google 登录:
security:
oauth2:
resource:
user-info-uri: https://www.googleapis.com/plus/v1/people/me
prefer-token-info: true
client:
client-id: xxxxx.apps.googleusercontent.com
access-token-uri: https://www.googleapis.com/oauth2/v3/tokeninfo
client-authentication-scheme: form
scope: email,profile
现在我需要为 Android 客户端添加配置。显然我不能这样做:
security:
oauth2:
resource:
user-info-uri: https://www.googleapis.com/plus/v1/people/me
prefer-token-info: true
client:
client-id: xxxxx.apps.googleusercontent.com
access-token-uri: https://www.googleapis.com/oauth2/v3/tokeninfo
client-authentication-scheme: form
scope: email,profile
client:
client-id: xxxxx.apps.googleusercontent.com
access-token-uri: https://www.googleapis.com/oauth2/v3/tokeninfo
client-authentication-scheme: form
scope: email,profile
这样做的正确方法和最佳实践是什么?
【问题讨论】:
-
我们在同一个人@Heisenbug。我有一种感觉,需要手动配置spring security来处理多个客户端id。也许这可以帮助指导您如何自定义弹簧安全性。 github.com/techdev-solutions/trackr-backend
-
@FrancisZabala 感谢您的回复。我尝试了以下方法:在 .yml 中,我只留下了服务器客户端 ID,一切都继续工作。现在我面临另一个问题:Android 没有自动接收 accessToken,获取它的最佳做法是什么?
-
我真的无法帮助您使用 android,但如果您的意思是您的 android 客户端如何使用访问令牌,您可能想知道 auth0 是如何工作的。这是他们文档的链接。 auth0.com/docs/quickstart/native/android 但是如果你想确保你的rest api很好,我还在做一些研究。
标签: spring spring-security spring-boot google-signin google-oauth