【Azure Developer】在使用中国区 Azure AD B2C时, AUTHORITY的值是什么呢? - LuBu0505/My-Code GitHub Wiki

问题描述

使用MSAL4J的SDK调用(源码地址:https://github.com/Azure-Samples/ms-identity-msal-java-samples/tree/main/3.%20Java%20Servlet%20Web%20App%20Tutorial/1-Authentication/sign-in-b2c#about-the-code),其中的一段代码中, AUTHORITY 地址在中国区Azure AD B2C中应该是什么呢?

IClientSecret secret = ClientCredentialFactory.createFromSecret(SECRET);
confClientInstance = ConfidentialClientApplication
                    .builder(CLIENT_ID, secret)
                    .b2cAuthority(AUTHORITY + policy)
                    .build(); 

在Github的实例代码中,AUTHORITY   = https://fabrikamb2c.b2clogin.com/tfp/fabrikamb2c.onmicrosoft.com/

问题解答

根据中国区文档的介绍以及示例中参考,在中国区AUTHORITY的值对应为   https://<your-tenant-name>.b2clogin.cn/<your-tenant-name>.partner.onmschina.cn/

参考资料

https://github.com/Azure-Samples/ms-identity-msal-java-samples/blob/main/3.%20Java%20Servlet%20Web%20App%20Tutorial/1-Authentication/sign-in-b2c/src/main/resources/authentication.properties 

https://docs.azure.cn/zh-cn/active-directory-b2c/b2clogin#what-endpoints-does-this-apply-to

https://docs.azure.cn/zh-cn/active-directory-b2c/configure-a-sample-node-web-app#step-5-configure-the-sample-web-app 

当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!

分类: 【Azure 环境】【Azure Developer】

标签: Azure DeveloperAzure 环境AUTHORITYAzure AD B2C