We have updated one of our development apps to use the gaming graph. Login to facebook (using Facebook APIs) works correctly, and returns an access token of the form "GG|{tokenString}". Attempting to pass this token to SignInWithCredentialAsync() results in:
(Inner Exception #0) Firebase.FirebaseException: The supplied auth credential is malformed or has expired.
We can confirm that that token is for the gaming graph API (by logging the Facebook AccessToken's GraphDomain) , however, when we attempt to log in to Firebase using a credential generated from that token, SignInWithCredentialAsync() throws an exception , the inner of which is:
(Inner Exception #0) Firebase.FirebaseException: The supplied auth credential is malformed or has expired.
Interestingly, Credential.IsValid() returns true.
We are as certain we've got this test right as it's possible to be when most of the opportunities for error are mostly app configuration dashboards rather than the 10 lines of fairly well tested code itself.
Relevant code:
Debug.Log($"Getting credential from access token {AccessToken.CurrentAccessToken.TokenString}");
Firebase.Auth.Credential credential = Firebase.Auth.FacebookAuthProvider.GetCredential(AccessToken.CurrentAccessToken.TokenString);
Debug.Log($"Credential has provider {credential.Provider} : IsValid {credential.IsValid()}" + credential.ToString());
var authTask = auth.SignInWithCredentialAsync(credential);
Debug.Log("Android debugging with printf is fun.");
try
{
var authUser = await authTask;
Debug.Log($"Firebase auth sign in task completed. IsCompleted:{authTask.IsCompleted} IsCanceled:{authTask.IsCanceled}. UserID {authUser.UserId} Provider: {authUser.ProviderId}");
}
catch (System.Exception ex)
{
...
---> (Inner Exception #0) Firebase.FirebaseException: The supplied auth credential is malformed or has expired.<---
Repro 100%
Hi @ferretnt
Firebase currently only support regular Facebook Login but not this separate login for gaming.
I can file a feature request for you. Since this will requires some backend changes, it probably will not be done soon.
Another option is to configure a generic OIDC provider by upgrading to GCIP.
https://cloud.google.com/identity-platform/docs/web/oidc
And you can use OAuthProvider to sign-in with Firebase Auth SDK.
var credential = Firebase.Auth.OAuthProvider.GetCredential("oidc.myProvider", idToken, accessToken);
var task = auth.SignInWithCredentialAsync(credential);
They have a different billing structure though since it charges a small amount per MAU.
Internal feature request tracking: b/171089917
Most helpful comment
Internal feature request tracking: b/171089917