# Facebook authentication

**URL:** <https://forum.heroiclabs.com/t/facebook-authentication/234>\
**Category:** Local Setup\
**Tags:** authentication\
**Created:** [September 25, 2019, 10:32am UTC](https://forum.heroiclabs.com/t/facebook-authentication/234 "2019-09-25T10:32:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brad9mm](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@brad9mm](https://forum.heroiclabs.com/u/brad9mm)\
**Post date:** [September 25, 2019, 10:32am UTC](https://forum.heroiclabs.com/t/facebook-authentication/234/1 "2019-09-25T10:32:46Z")

</div>

```
var perms = new List<string>(){"public_profile", "email"};
FB.LogInWithReadPermissions(perms, async (ILoginResult result) => {
    if (FB.IsLoggedIn) {
        var accessToken = Facebook.Unity.AccessToken.CurrentAccessToken;
        var session = await client.LinkFacebookAsync(session, accessToken);
        Debug.LogFormat("New user: {0}, {1}", session.Created, session);
    }
});

```

aftre binding this function to a button in unity i get the error on this line  
“var session = await client.LinkFacebookAsync(session, accessToken);”  
error is :: can’t convert void into task(Isession).

---

<div class="post-metadata">

**Author:** ![zyro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/zyro/32/14_2.png) [@zyro](https://forum.heroiclabs.com/u/zyro)\
**Post date:** [September 25, 2019, 1:57pm UTC](https://forum.heroiclabs.com/t/facebook-authentication/234/2 "2019-09-25T13:57:29Z")

</div>

> [@brad9mm](#):
>
> var session = await client.LinkFacebookAsync(session, accessToken);

`client.LinkFacebookAsync` does not return a new session. Linking a new social provider to an existing account does not change the account itself or the session token.

Just use `await client.LinkFacebookAsync(session, accessToken);` by itself.
