Вход в Facebook через пользовательскую политику Azure AD B2C - PullRequest
0 голосов
/ 03 мая 2018

Я создал собственную политику, используя Identity Experience Framework. Я могу зарегистрироваться и войти в систему, используя локальную учетную запись, но когда я пытаюсь использовать Facebook в качестве социальной учетной записи, я сталкиваюсь с некоторой ошибкой.

Проблема: когда я щелкаю по Facebook (логин в социальной сети) в своей пользовательской политике, меня перенаправляют в FB для входа в систему, но после входа в систему из FB я вижу ниже ошибку из приложений.

{
""Kind"": ""HandlerResult"",
""Content"": {
  ""Result"": true,
  ""RecorderRecord"": {
    ""Values"": [
      {
        ""Key"": ""SendErrorTechnicalProfile"",
        ""Value"": ""OAuth2ProtocolProvider""
      },
      {
        ""Key"": ""Exception"",
        ""Value"": {
          ""Kind"": ""Handled"",
          ""HResult"": ""80131500"",
          ""Message"": ""An exception was caught when making a request to URL \""https://graph.facebook.com/oauth/access_token\"" using method \""Get\"". The exception status code was \""ProtocolError\"" with the following message: {scrubbed}."",
          ""Data"": {},
          ""Exception"": {
            ""Kind"": ""Handled"",
            ""HResult"": ""80131509"",
            ""Message"": ""The remote server returned an error: (400) Bad Request."",
            ""Data"": {}
          }
        }
      }
    ]
  }
}

},

есть мысли?

<TechnicalProfiles>
    <TechnicalProfile Id="Facebook-OAUTH">
      <!-- The text in the following DisplayName element is shown to the user on the claims provider selection screen. -->
      <DisplayName>Facebook</DisplayName>
      <Protocol Name="OAuth2" />
      <Metadata>
        <Item Key="ProviderName">facebook</Item>
        <Item Key="authorization_endpoint">https://www.facebook.com/dialog/oauth</Item>
        <Item Key="AccessTokenEndpoint">https://graph.facebook.com/oauth/access_token</Item>
        <Item Key="ClaimsEndpoint">https://graph.facebook.com/me?fields=id,first_name,last_name,name,email,picture</Item>
        <Item Key="scope">email</Item>
        <Item Key="HttpBinding">GET</Item>
        <Item Key="client_id">xxxxxxxx</Item>
        <Item Key="UsePolicyInRedirectUri">0</Item>
      </Metadata>
      <CryptographicKeys>
        <Key Id="client_secret" StorageReferenceId="B2C_1A_FacebookSecret" />
      </CryptographicKeys>
      <InputClaims />
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="userId" PartnerClaimType="id" />
        <OutputClaim ClaimTypeReferenceId="givenName" PartnerClaimType="first_name" />
        <OutputClaim ClaimTypeReferenceId="surname" PartnerClaimType="last_name" />
        <OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="name" />
        <OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="email" />
        <OutputClaim ClaimTypeReferenceId="identityProvider" DefaultValue="facebook.com" />
        <OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="socialIdpAuthentication" />
        <OutputClaim ClaimTypeReferenceId="extension_picture"  PartnerClaimType="picture"/>
      </OutputClaims>
      <OutputClaimsTransformations>
        <OutputClaimsTransformation ReferenceId="CreateRandomUPNUserName" />
        <OutputClaimsTransformation ReferenceId="CreateUserPrincipalName" />
        <OutputClaimsTransformation ReferenceId="CreateAlternativeSecurityId" />
        <OutputClaimsTransformation ReferenceId="CreateSubjectClaimFromAlternativeSecurityId" />
      </OutputClaimsTransformations>
      <UseTechnicalProfileForSessionManagement ReferenceId="SM-SocialLogin" />
    </TechnicalProfile>
  </TechnicalProfiles>

1 Ответ

0 голосов
/ 12 мая 2018

Вы также должны добавить следующий элемент в <Metadata />:

<Item Key="AccessTokenResponseFormat">json</Item>

Подробнее см. в этом блоге .

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...