Here's what I currently have:
-
Spring REST服务,其中许多API要求用户进行身份验证
-
A 'registration' API(/ api / v1 / register)
-
'login'采用用户名/密码的API(/ api / v1 / login)
-
'Facebook Login'依赖Spring Social和Spring Security创建用户连接并在(/ auth / facebook)中记录用户的API
我的问题是我希望这些API被多个客户端使用,但Facebook登录的方式现在,它在移动设备上运行不佳(在网站上运行良好) .
Here's the mobile scenario:
-
我使用Facebook的iOS SDK来请求用户的许可
-
Facebook返回用户访问令牌
-
I want to send my backend service this token and have Spring Social accept it, create the User Connection, etc.
可以这样做吗?或者我是否必须编写自己的API以持久保存用户连接?
感谢任何帮助!
1 回答
我有完全相同的问题,这就是我如何使它工作 . 您可能在某处具有SocialConfigurer,其中包含以下内容:
从这里开始,您可以在Controller / RestController中添加一个映射,其中包含您将发送到服务器的令牌的RequestParam:
Useful references
UsersConnectionRepository
ConnectionRepository