Connect facebook login to firebase in unity

I want in my unity game with firebase facebook login when user login through facebook there user name, email & profile picture save in firebase. I tried from firebase unity login auth docs but i cant get any thing from there. On there docs to difficult to understand for beginners.

using UnityEngine;
using Facebook.Unity;
using UnityEngine.UI;
using Firebase.Auth;


public class FacebookManager : MonoBehaviour
{
public Text userIdText;
private FirebaseAuth mAuth;



private void Awake()
{



    if (!FB.IsInitialized)
    {
        FB.Init();
    }
    else
    {
        FB.ActivateApp();
    }
}

public void LogIn()
{
    FB.LogInWithReadPermissions(callback:OnLogIn);


}
private void OnLogIn(ILoginResult result)
{
    if (FB.IsLoggedIn)
    {
        AccessToken tocken = AccessToken.CurrentAccessToken;
        userIdText.text = tocken.UserId;
        Credential credential =FacebookAuthProvider.GetCredential(tocken.UserId);

    }
    else
    {
        Debug.Log("Login Failed");
    }
}

public void accessToken(Credential firebaseResult)
{
    FirebaseAuth auth = FirebaseAuth.DefaultInstance;
    if (!FB.IsLoggedIn)
    {
        return;
    }

    auth.SignInWithCredentialAsync(firebaseResult).ContinueWith(task =>
    {
        if (task.IsCanceled)
        {
            Debug.LogError("SignInWithCredentialAsync was canceled.");
            return;
        }
        if (task.IsFaulted)
        {
            Debug.LogError("SignInWithCredentialAsync encountered an error: " + task.Exception);
            return;
        }

        FirebaseUser newUser = task.Result;
        Debug.LogFormat("User signed in successfully: {0} ({1})",
            newUser.DisplayName, newUser.UserId);
    });
}
}

Please help me i am beginner in coding

Hello @LZYGYZ

I had some problems but eventually I could login and get the profile picture and so,

first of all you need to fix line 41 and send the token string not the userId

Credential credential = FacebookAuthProvider.GetCredential(tocken.TokenString);

next I failed to use firebase returned data to get the data I need, So it was a better idea to use facebook APIs for that!
inspired by this Android Firebase Auth - Get User's Photo - Stack Overflow

I got the profile picture for instance like them I had to use the next combination

 const string fbLink = "https://graph.facebook.com/";
 const string fbPic = "/picture?type=large";
 string photoURL = string.Format("{0}{1}{2}",  fbLink , token.UserId, fbPic);

That’s all, if you need anything else let me know!

You need to use Facebook SDK for Unity, login and after you logged, get token string to continues with firebase auth.