用户通过我的移动应用程序通过 facebook 进行身份验证后,如何实现正常的门卫 oauth2 流程?
PS 我正在使用 doorkeeper gem 为我的移动应用程序实现 oauth2 提供程序。我使用资源所有者密码凭据流通过用户的用户名和密码实现身份验证。
因此,如果用户首先通过移动应用程序通过 facebook 进行身份验证,我该如何使用 facebook 访问 token 通过 doorkeeper 对用户进行身份验证。所以在这种情况下不存在用户名/密码(门卫抛出缺少参数的错误)。
实现此流程的正确方法是什么。
1. User authenticates from facebook through the mobile app.
2. Facebook access token is passed to the API server.
3. If the access token is valid, the api server returns the
doorkeeper access token.
4. In case the access token is not valid, the api server returns 401 Unauthorized.
实现此流程的正确方法是什么?非常感谢一些正确方向的指导。
最佳答案
对现有看门人授权流程的扩展,正好解决了这个问题: https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
断言流程是提供者的 access_token 与来自您的 oauth 提供者的访问 token 之间的交换。
关于ruby-on-rails - facebook 身份验证后与门卫进行身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19241063/