# Facebook login success, but not receiving facebook id

**URL:** <https://forum.heroiclabs.com/t/facebook-login-success-but-not-receiving-facebook-id/3650>\
**Category:** Client Libraries\
**Tags:** authentication\
**Created:** [March 18, 2023, 3:20am UTC](https://forum.heroiclabs.com/t/facebook-login-success-but-not-receiving-facebook-id/3650 "2023-03-18T03:20:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bodin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/bodin/32/1260_2.png) [@bodin](https://forum.heroiclabs.com/u/bodin)\
**Post date:** [March 18, 2023, 3:20am UTC](https://forum.heroiclabs.com/t/facebook-login-success-but-not-receiving-facebook-id/3650/1 "2023-03-18T03:20:22Z")

</div>

Hi,

Facebook login was working fine until recently. but one day, it returned error.

so I upgrade facebook SDK version from 11.0 → 16.0  
now I can log in with facebook, but it created new account instead of logging in to existing account.

and when I checked on nakama console, the newly created account have no facebook id in authentication info. (please check image below)

 ![fbidnotshow](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/5/59dfbd3805076292ed7f099e72aa4cad5bc7f953.png)

is there any change on facebook side that cause this? here is the version info on my setup.

Nakama Client version : 3.4.1 (Unity SDK)  
Nakama Server version: 3.13.1+2000e4b8  
Facebook SDK version: 16.0

Thank in advance for any answer & Best regards,  
Bodin

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [March 20, 2023, 2:18pm UTC](https://forum.heroiclabs.com/t/facebook-login-success-but-not-receiving-facebook-id/3650/2 "2023-03-20T14:18:22Z")

</div>

@bodin do you see any errors in the server logs? If yes can you please share them?

---

<div class="post-metadata">

**Author:** ![bodin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/bodin/32/1260_2.png) [@bodin](https://forum.heroiclabs.com/u/bodin)\
**Post date:** [March 21, 2023, 7:19am UTC](https://forum.heroiclabs.com/t/facebook-login-success-but-not-receiving-facebook-id/3650/3 "2023-03-21T07:19:07Z")

</div>

Hi sesposito,

Thank you very much for your reply.  
I logged in with facebook auth again, and checked on server logs, but there’s no error happen there.

I tested again on API Explorer. eveything seem to be fine. I got token & refreshToken back as expected. except there’s nothing appear on the account authentication info.

 ![fbauth](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/0/0e84831fa49915b45dec69556c854820b152abdf.jpeg)

---

<div class="post-metadata">

**Author:** ![SamFashionLeague](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/samfashionleague/32/2206_2.png) [@SamFashionLeague](https://forum.heroiclabs.com/u/SamFashionLeague)\
**Post date:** [June 11, 2024, 3:01pm UTC](https://forum.heroiclabs.com/t/facebook-login-success-but-not-receiving-facebook-id/3650/4 "2024-06-11T15:01:17Z")

</div>

I would like to bump this error since we are experiencing a similar issue. We are using FB-SDK 17 and they introduced after the ATT a need for a limited login.

Since this would be like a common flow for our users we need to take that into account.

this is the link to their SDK mentioning some issues just in case it helps: [The accessToken generated by SDK 17.0.0 is Invalid: `Invalid OAuth access token - Cannot parse access token ` · Issue #2365 · facebook/facebook-ios-sdk · GitHub](https://github.com/facebook/facebook-ios-sdk/issues/2365)

but I have been trying to link facebook when the jwt token is being received after getting “success” from the login function and nothing appeared in the nakama panel. There is just a message on the docker logs saying “Checking Facebook limited Login…” and then the jwt token.

Then in consecutive attempts of login I get an error saying “409:Facebook ID is already in use.” but in the panel there is none.

Server version is v1.28.0 and sdk on client is 3.12.1].

Also, I would like to ask, what should be the correct flow to ensure that FB login can serve to recover profile from a linked account?

Profile device A → Connect to FB → Link FB to profileA  
Profile device B → Connect to FB (same FB as before) → login instead of link?

Thank you so much, Regards.

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [June 12, 2024, 10:12am UTC](https://forum.heroiclabs.com/t/facebook-login-success-but-not-receiving-facebook-id/3650/5 "2024-06-12T10:12:05Z")

</div>

Hello @SamFashionLeague,

For subsequent login attempts are you making sure the `create` flag is set to false?

Let me know if the error persists, and what server version you are running (the version you provided seems incorrect).

Best.

---

<div class="post-metadata">

**Author:** ![SamFashionLeague](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/samfashionleague/32/2206_2.png) [@SamFashionLeague](https://forum.heroiclabs.com/u/SamFashionLeague)\
**Post date:** [June 13, 2024, 8:52am UTC](https://forum.heroiclabs.com/t/facebook-login-success-but-not-receiving-facebook-id/3650/6 "2024-06-13T08:52:49Z")

</div>

Hey Sesposito, thanks for your response.

We’ve updated to the latest server (nakama-common@v1.32.0) with dependencies (3.22.0 on pluginbuilder, and protobuf@v1.34.1 ) somehow it fixed all the issues.

Somehow now the jwt token works and gets validated. In Nakama panel I can see now the FB-ID associated and the link to the public picture.

I am unaware if there were some changes from nakama-common@v1.28.1 to this one but now seems fixed.

Btw, instead of setting the flag to false what I do is to recover if there is any fb-id associated to that account passing the authToken (whatever it is) and handle the flow after successful fb auth to reload the scene and get the associated profile.

```auto
try
{
    var account = await Client.GetAccountAsync(Session);
    var linkedFacebookId = account.User.FacebookId;

    if (!string.IsNullOrEmpty(linkedFacebookId))
    {
        Debug.Log($"Facebook already linked : {linkedFacebookId}");
        return;
    }

    await Client.LinkFacebookAsync(Session, authToken);
}
catch (ApiResponseException ex)
{
    Debug.LogFormat("Error linking facebook: {0}:{1}", ex.StatusCode, ex.Message);
}

```

Seems to work pretty well.

Thank you so much. Sam.
