首页 文章

Azure B2C AD重定向到Angular应用程序

提问于
浏览
3

我正在尝试运行使用Azure B2C Active Directory和adal-angular 4的this Angular 4 example .

为了运行应用程序,在Azure中我创建了一个租户,在AD B2C中注册了一个应用程序,并添加了一个https://localhost:4200的回复URL . 然后我将应用程序ID和租户添加到我的Angular App中 .

当我运行该应用程序时,它正确地重定向到https://login.microsoftonline.com ...加载登录 . 正确登录会重定向到https://localhost:4200 .

当我退出时,有一个问题 . 该应用程序被重定向到this static logout page,它不会重定向回我的应用程序 .

我尝试在Azure Active Directory(而非B2C)中注册应用程序,将其配置数据移动到我的Angular App中,当我运行它并注销时,它会暂时重定向到this "logging you out" page,重定向回应用程序 .

注销后的重定向URL与租户名称不同,只有B2C才会死亡 . Chrome和Edge都会发生这种情况 .

我希望这不仅仅是B2C和常规AD之间的功能差异 . 我检查了我的配置,但也许这是我错过的Azure门户网站中的内容?

2 回答

  • 1

    注销请求应包括“p”和“post_logout_redirect_uri”参数,例如:

    GET https://login.microsoftonline.com/{tenant}/oauth2/v2.0/logout?p=b2c_1_sign_up_sign_in&post_logout_redirect_uri=https%3A%2F%2Flocalhost%3A4200%2F
    

    如果未指定“post_logout_redirect_uri”参数,则Azure AD B2C将显示常规消息 .

  • 1

    你应该使用MSAL.js w / Azure AD B2C .

    ADAL ...旨在仅针对Azure AD“经典”(例如 - NOT B2C)

    参考:MSAL or ADAL library for use with Azure AD B2C and Xamarin


    Angular 4 example使用MSAL.js .

相关问题