Oauth2 password grant type with Doorkeeper and Angular

大憨熊 提交于 2019-12-13 12:42:57

问题


I've got a Rails API that is using Doorkeeper with the password grant method for Oauth2.

Doorkeeper requires both the client_id and client_secret to be sent to the token request (/oauth/token), alongside the user's login details and scope.

How would I go about doing this in an Angular app? I don't like the idea of storing the client id and secret client side...


回答1:


The client_id and client_secret should only be used when your app code is secured, i.g. inside your web server.

For browser web apps and mobile apps the oauth implicit flow or the password flow should be used.

  1. In the implicit flow, you only use the client_id.
  2. In the password flow, you exchange the username and password for an access token.


来源:https://stackoverflow.com/questions/24548977/oauth2-password-grant-type-with-doorkeeper-and-angular

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!