Facebook authentication

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).

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.

1 Like