简体   繁体   English

Azure B2C 身份验证与隐式授权流程

[英]Azure B2C authentication with Implicit Grant Flow

I'm using an Azure B2C Tenant which has some users.我正在使用有一些用户的Azure B2C 租户 I created an application and in the authentication I choose web .我创建了一个应用程序并在身份验证中选择web I deselected the implicit grant flow because I was getting the warning This app has implicit grant settings enabled. If you are using any of these URIs in a SPA with MSAL.js 2.0, you should migrate URIs.我取消选择了隐式授权流程,因为我收到警告This app has implicit grant settings enabled. If you are using any of these URIs in a SPA with MSAL.js 2.0, you should migrate URIs. This app has implicit grant settings enabled. If you are using any of these URIs in a SPA with MSAL.js 2.0, you should migrate URIs. I selected Local only and no other provider.我只选择了本地,没有选择其他提供商。 I also have a Sing In User flow.我还有一个 Sing In User 流程。 I could not even see the login page from my C# ASP.NET application with those settings.使用这些设置,我什至无法从我的 C# ASP.NET 应用程序中看到登录页面。 So I selected the implicit flow .所以我选择了隐式流 That solved the problem and I can see the login page and can login.这解决了问题,我可以看到登录页面并可以登录。

My question is why should I need am implicit flow for a web authentication.我的问题是为什么我需要隐式流程来进行web身份验证。

在此处输入图像描述

You don't need implicit flow unless you are using older versions of MSAL ie, MSAL1.XXX version.除非您使用旧版本的 MSAL,即 MSAL1.XXX 版本,否则您不需要隐式流。

The latest version of MSAL.js ie, MSAL 2.XXX version only works with the authorization code flow with PKCE instead of implicit flow.最新版本的 MSAL.js 即 MSAL 2.XXX 版本仅适用于带有 PKCE 的授权代码流,而不是隐式流。 So you need to implement PKCE flow instead of implicit Grand.所以你需要实现 PKCE 流而不是隐式 Grand。

If you are using latest version of MSAL please don't use Access_token and id_token settings which will enable implicit flow.如果您使用的是最新版本的 MSAL,请不要使用Access_tokenid_token设置,这将启用隐式流。

If you're using the Microsoft Identity Web authentication library or one of the Microsoft Identity Web project templates, then it passes response_type=code id_token in the authorization request, which represents the hybrid flow .如果您使用的是 Microsoft Identity Web 身份验证库或 Microsoft Identity Web 项目模板之一,则它会在授权请求中传递response_type=code id_token ,这表示混合流

This is why you must select the "ID tokens" settings for the application registration.这就是为什么您必须为应用程序注册 select 的“ID 令牌”设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM