how to get Facebook profile picture using Azure AD B2C

后端 未结 1 1764
醉梦人生
醉梦人生 2021-02-15 15:08

I am using MSAL.js and could successfully sign-in/sign-up users in Azure AD B2C using Facebook as identity provider. The problem is that after sign-in I cannot retrieve user\'s

1条回答
  •  一生所求
    2021-02-15 15:43

    Using custom policies, you can retrieve the picture field for the Facebook user and then issue a picture claim in the ID token, as follows.

    1: Complete the Azure Active Directory B2C: Get started with custom policies steps with one of the social account policies such as the SocialAndLocalAccounts one.

    2: Declare a "picture" claim in the extensions file:

    
      Picture
      string
    
    

    3: Add both the "picture" field to the "ClaimsEndpoint" metadata item and the "picture" output claim to the "Facebook-OAUTH" technical profile in the extensions policy:

    
      Facebook
      
        
          
            facebook_clientid
            email public_profile
            https://graph.facebook.com/me?fields=id,first_name,last_name,name,email,picture
          
          
            
          
        
      
    
    

    4: Issue the "picture" claim in the sign-up or sign-in relying party policy:

    
      
      
        PolicyProfile
        
        
          
          
          
          
          
          
          
        
        
      
    
    

    0 讨论(0)
提交回复
热议问题