带门卫和Angular的Oauth2密码授予类型 [英] Oauth2 password grant type with Doorkeeper and Angular

查看:154
本文介绍了带门卫和Angular的Oauth2密码授予类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Rails API,它使用Doorkeeper和Oauth2的密码授予方法.

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

Doorkeeper要求同时将client_idclient_secret以及用户的登录详细信息和范围发送到令牌请求(/oauth/token).

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.

我将如何在Angular应用中执行此操作?我不喜欢存储客户端ID和秘密客户端的想法...

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...

推荐答案

client_id和client_secret仅应在您的应用程序代码受保护的情况下使用,例如在您的Web服务器中.

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

对于浏览器Web应用程序和移动应用程序,应使用oauth隐式流或密码流.

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

  1. 在隐式流程中,您仅使用client_id.
  2. 在密码流中,您将用户名和密码交换为访问令牌.

这篇关于带门卫和Angular的Oauth2密码授予类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆