[英]Oauth 2.0 get access token without redirecting the user to different page
I wanted to implement a login flow where users can log on my website using 我想实现一个登录流程,使用户可以使用以下方式登录我的网站
For point 1, I get it that 对于第一点,我明白了
For point 2, 对于第二点
My query: 我的查询:
I am new to Oauth so please correct me if I am wrong anywhere. 我是Oauth的新手,所以如果我在任何地方都不对,请纠正我。
Note: My Client application is an Angular 2 app in browser. 注意:“我的客户端”应用程序是浏览器中的Angular 2应用程序。
Thanks. 谢谢。
You can use a popup sign-in window to complete the sign in with the implicit flow. 您可以使用弹出式登录窗口以隐式流程完成登录。 This will load up the identity providers sign-in page (the /authorize endpoint), but will not do a full redirect in your browser.
这将加载身份提供者登录页面(/ authorize端点),但不会在浏览器中进行完全重定向。 Then the identity provider can set the appropriate cookies and get you an access token.
然后,身份提供者可以设置适当的cookie并获取访问令牌。 This is the canonical pattern for single-page apps (angular, react, etc.).
这是单页应用程序的规范模式(角度,反应等)。 Here's some reading that can give some color to the protocol (in the scope of Azure AD, but a lot of this transcends identity provider implementation details).
这是一些可以给协议增添色彩的读物 (在Azure AD的范围内,但其中很多超越了身份提供程序的实现细节)。
The resource owner password flow is generally not a good idea, but can be used in a few situations. 资源所有者密码流通常不是一个好主意,但是可以在少数情况下使用。 Things like daemons apps or testing are good cases.
守护程序应用程序或测试之类的东西就是很好的例子。 In general, it's very brittle and won't support things like MFA or dynamic consent situations.
一般来说,它非常脆弱,不支持MFA或动态同意情况。 Moreover, it's intrinsically less secure that a tradtional implicit or auth code flow.
而且,从本质上讲,传统的隐式或身份验证代码流的安全性较低。 Here's a great blog post about good cases to use it in the scope of Azure AD (enterprise account identity provider).
这是一篇很棒的博客文章,介绍了在Azure AD(企业帐户身份提供者)的范围内使用它的良好案例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.