【发布时间】:2018-05-23 18:42:13
【问题描述】:
我正在使用自定义策略将 GitHub 设置为 Azure AD B2C 中的自定义提供程序。我能够进入登录页面并成功重定向回正确的 azure 广告链接,但 Azure AD B2C 中的服务器错误始终拒绝 OAUTH 的第二部分。
当我查看应用洞察跟踪日志时,它显示“收到无效的 OAuth 响应”和“解析值时遇到意外字符:a”。这是我设置的策略提供程序:
<ClaimsProvider>
<Domain>github.com</Domain>
<DisplayName>GitHub</DisplayName>
<TechnicalProfiles>
<TechnicalProfile Id="GitHub-OAUTH">
<DisplayName>GitHub</DisplayName>
<Protocol Name="OAuth2" />
<Metadata>
<Item Key="ProviderName">github</Item>
<Item Key="authorization_endpoint">https://github.com/login/oauth/authorize</Item>
<Item Key="AccessTokenEndpoint">https://github.com/login/oauth/access_token?</Item>
<Item Key="HttpBinding">POST</Item>
<Item Key="ClaimsEndpoint">https://api.github.com/user</Item>
<Item Key="client_id">My Client Id</Item>
<Item Key="UsePolicyInRedirectUri">0</Item>
<Item Key="scope">user</Item>
<Item Key="response_types">code</Item>
</Metadata>
<CryptographicKeys>
<Key Id="client_secret" StorageReferenceId="B2C_1A_GitHubSecret" />
</CryptographicKeys>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="socialIdpUserId" PartnerClaimType="id" />
<OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="email" />
<OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="name" />
<OutputClaim ClaimTypeReferenceId="identityProvider" DefaultValue="github.com" />
<OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="socialIdpAuthentication" />
</OutputClaims>
<OutputClaimsTransformations>
<OutputClaimsTransformation ReferenceId="CreateRandomUPNUserName" />
<OutputClaimsTransformation ReferenceId="CreateUserPrincipalName" />
<OutputClaimsTransformation ReferenceId="CreateAlternativeSecurityId" />
</OutputClaimsTransformations>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-SocialLogin" />
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>
我想知道问题是不是在 json 中没有返回 access_token?我自己在 postman 中逐步完成了所有步骤,代码作为 url 参数返回,access_token 在响应的正文中返回,如下所示:
access_token=<snip>&scope=user%3Aemail&token_type=bearer
我是否缺少自定义提供程序中的元数据项来支持此响应?或者这在 Azure AD B2C 中不起作用?
【问题讨论】:
标签: azure oauth-2.0 azure-ad-b2c