我在本教程之后在ADB2C上正常工作我可以使用Adal创建用户。(这是场景的上下文)
我的目标是发送用户邀请(电子邮件)以使他加入我的Appp。
我在Graph.microsoft.com(MS图而不是广告图)上发现邀请管理器可以用于该目的,并且可能是如果您在该邀请上创建用户,则可以触发邀请。B2C Azure Portal。
- 所以我需要给我的应用程序许可(就像我获得的方式一样在广告图上访问令牌以管理用户)?
- 我应该按照AD的方式在MS图上获取令牌
AuthorizationCodeReceived = async (context) =>
{
// get authentication context
string userObjectID = context.AuthenticationTicket.Identity.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier").Value;
AuthenticationContext authContext = new AuthenticationContext($"https://login.microsoftonline.com/{AuthenticationHelper.Tenant}", new NaiveSessionCache(userObjectID));
ClientCredential credential = new ClientCredential(AuthenticationHelper.ClientId, AuthenticationHelper.AppKey);
AuthenticationResult result = await authContext.AcquireTokenAsync("https://graph.windows.net", credential);
// ----> Token used on the authorization header for AD user management and work properly
AuthenticationHelper.Token = result.AccessToken;
// Token for MS graph
ClientCredential MSCredential = new ClientCredential(AuthenticationHelper.MSClientId, AuthenticationHelper.MSAppKey);
AuthenticationResult resultMSGraph = await authContext.AcquireTokenAsync("https://graph.microsoft.com", MSCredential);
// ----> Token used on the authorization header for MS Graph and is not working !!
AuthenticationHelper.MSGraphToken = resultMSGraph.AccessToken;
},
感谢您的帮助
Microsoft图上的邀请经理API不支持Azure AD B2C。目前,邀请经理API旨在供企业/常规Azure AD租户邀请其他用户作为客人(请参阅Azure AD B2B协作)。
Azure AD B2C Uservoice论坛中已经有一个条目,要求发送电子邮件邀请供新用户注册。我建议您投票支持此条目,以帮助我们优先考虑它,并保持最新的进度。
在此期间,您必须自己实施,要么简单欢迎电子邮件或更复杂的"赎回代码"工作流。