Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

661
Views
Facebook Authentication using Unity and Firebase: Credential malformed or expired

I saw that a some people encountered this issue but none of the answers help me actually.

So, I'm creating an app on unity (2020.1.11f1) and I'm using Firebase to deal with the authentication process. Email/Password authentication is working but now that I'm dealing with facebook authentication, I'm running into the famous error:

Firebase.FirebaseException: The supplied auth credential is malformed or has expired

I logged my app into facebook developper and connect it to firebase. I doubled check App ID and Secret ID. Also, my token is valid since I'm checking its validity. Also, it knows that it is coming from facebook.

I'm using the piece of code (coming from official documentation):

private void facebook_loginFirebase(string accessToken)
        {
            //Get firebase authenticator and credential to perform connection
            Firebase.Auth.FirebaseAuth auth = Firebase.Auth.FirebaseAuth.DefaultInstance;
            Firebase.Auth.Credential credential = Firebase.Auth.FacebookAuthProvider.GetCredential(accessToken);

            //Perform Connection
            auth.SignInWithCredentialAsync(credential).ContinueWith(task => {
                if (task.IsCanceled)
                {
                    Debug.LogError("SignInWithCredentialAsync was canceled.");
                    popup_manager.openErrorPopup("5010", "Task has been cancelled");
                    return;
                }
                if (task.IsFaulted)
                {
                    Debug.LogError("SignInWithCredentialAsync encountered an error: " + task.Exception);
                    popup_manager.openErrorPopup("5011", "An error happened: " + task.Exception);
                    return;
                }

                Firebase.Auth.FirebaseUser newUser = task.Result;
                Debug.LogFormat("User signed in successfully: {0} ({1})",
                    newUser.DisplayName, newUser.UserId);
                popup_manager.openInformationPopup("Account created with userID: " + newUser.UserId);

            });
        }

Also, I'm using Facebook SDK 9.0. It seems it has changed a bit from previous versions and all tutorial on internet are based on old versions. Do you have any more tips to check?

Thanks in advance! Let me know if I need to give you more information!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I found the error with the help of a friend. So basically, it came from the app created on facebook developper. When you create the app, you'll have the choice between:

  • Manage business integration
  • Build or connect to a game
  • Build connected experiences
  • More option

My game was a game for android and iOS so I selected the second option. Thing is, I needed the third option because my game was not going to be released on Facebook. When you select the second option, your token will start by GG and it will throw the error when using SignInWithCredentialAsync().

This link helped me: https://github.com/firebase/quickstart-unity/issues/826

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!