我有以下问题:是否可能?如果可能,集成 OAuth2、Devise 和 Doorkeeper 的最佳方式是什么?当然,我的主要目标是保护我的 API 所在的 RoR 服务器。只有 token ,没有 session 。
我想使用资源所有者密码凭证流程。我有两个注册的应用程序:一个在 AngularJS 中,另一个是 Android 应用程序,人们可以在其中访问服务器的 API。
使用 Devise 和 Doorkeeper,是否可以通过 Devise 管理注册?还是我什至需要 Devise 来解决我的问题? 我已经阅读了自定义 OAuth 策略 - 我应该在我的项目中使用它吗?
最佳答案
查看这个示例项目,它具有使用 Devise、Doorkeeper、CanCan 和 rails-api 的框架。
https://github.com/rilian/devise-doorkeeper-cancan-api-example
自述文件:
Rails API with a nice User management via devise gem, with both frontend forms and JSON access, and with a token-based OAuth authentication via doorkeeper. Sample authorization is done with cancancan and also is tested.
Features:
- User Signup
- Restore password
- Modify own user profile
- User password-based authentication
- Client application authentication
- Access with OAuth access_token
- Generate new access_token via refresh_token
- Authorization
我刚刚开始使用 Rails 和 Doorkeeper,我发现掌握这些概念以及它们如何组合在一起非常有用。
关于security - 集成 Devise、Doorkeeper 和 OAuth2 的最佳方式是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32167529/