Facebook social login with identity platform

hello,
I am trying to implement facebook social login in our FastAPI based application, integrating with Identity platform (identity toolkit APIs). Upon adding facebook identity provider under the identity platform, I could successfully invoke createAuthUri and signInWithIdp endpoints. However, there are some observations from the entire login flow - 

1. signInWithIdp endpoint response doesn't return idToken or refreshToken. It returns token value in oauthAccessToken field and the token doesn't seem to be a valid JWT.

2. Even with successful signInWithIdp API execution, facebook user is not added under the users tab in identity platform.

Can someone have a look at the APIs for facebook social login and provide resolution.

 



 

1 3 698
3 REPLIES 3

Hello @kshitij-enable,

If you're referring to Identity Platform's REST API, the signInWithIdp should be able to return idToken and Refresh Token. Make sure that before using the REST API, you have an Identity Platform API key

You can try a sample request with Oauth access token:

curl 'https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=[API_KEY]' \
-H 'Content-Type: application/json' \
--data-binary '{"postBody":"access_token=[FACEBOOK_ACCESS_TOKEN]&providerId=[facebook.com]","requestUri":"[http://localhost]","returnIdpCredential":true,"returnSecureToken":true}'

 You can also check out this documentation on how to use Identity Platform to sign in users with Facebook.

If the above options don't work, you can contact Google Cloud Support to further look into your case. Let me know if it helped, thanks!

Hello @Marramirez ,

I have followed the same documentation to execute signInWithIdp API for facebook login. The execution is successful, however the response doesn't consist of idToken and refresh token as mentioned in the documentation.

Response received from the API is as follows : 

 

{
  "federatedId": "http://facebook.com/10160782630230610",
  "providerId": "facebook.com",
  "email": <PII removed by staff>,
  "emailVerified": false,
  "firstName": <PII removed by staff>,
  "fullName": <PII removed by staff>,
  "lastName": <PII removed by staff>,
  "photoUrl": "https://graph.facebook.com/10160782630230610/picture",
  "localId": "fnJfJQWZwcSQzYpJQhAHL9A0sNT2",
  "displayName": <PII removed by staff>,
  "context": "",
  "verifiedProvider": ["google.com"],
  "needConfirmation": true,
  "oauthAccessToken": "EAAJuBOBbA2MBO0wc481brEL0VQLDRv6JUMANGpiT0ZCBEo9FK2NxA5yMZAdf0ar4UXIBv2pjJ15h79K3JAvTgd1LTAOkDkQgcNE9J8DwV7XnwsdjPuZAxDy4uWnoJHnHiJ7ZCOXN9u9e3UtQW0EgH7K7QfZCvpJdZAvPGkmYzZAYmLyI4n7VzVWKZANe6NgCEtrNEMN3IoFlZCsXTTGdKHZCB2Q56Si9v2iQGY0cZClQpabBqVcjXOFugZDZD",
  "oauthExpireIn": 5183999,
  "rawUserInfo": "{\"name\":\"Kshitij Kasliwal\",\"last_name\":\"Kasliwal\",\"granted_scopes\":[\"email\",\"public_profile\"],\"id\":\"10160782630230610\",\"first_name\":\"Kshitij\",\"email\":\"kasli.kk@gmail.com\",\"picture\":{\"data\":{\"is_silhouette\":false,\"width\":100,\"url\":\"https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=10160782630230610&height=100&width=100&ext=1694276525&hash=AeToNnyZbdvJ4vrMAnE\",\"height\":100}}}",
  "kind": "identitytoolkit#VerifyAssertionResponse",
  "tenantId": "enable-staging-ext-hnr1f"
}

 

 

 

 

hey, i've got the same issue - did you manage to resolve it?