Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

672
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda