Reputation: 397
I am trying to get ID Token to access files on Firebase storage. I'm using C# xamarin.
user = await Firebase.Auth.FirebaseAuth.Instance.SignInWithEmailAndPasswordAsync(email, password);
rawResult = await user.User.GetIdToken(false);
if (rawResult is GetTokenResult res)
{
return res.Token;
}
It gives me authentication token that is very long.
But actually I need ID Token that is short.
How do I get ID Token?
Upvotes: 0
Views: 2079
Reputation: 53
Cherry Bu - GetIdTokenAsync(false) is no longer useable (deprecated). Which Nugets and versions are you using please?
Upvotes: 1
Reputation: 10346
It gives me authentication token that is very long.But actually I need ID Token that is short.
I use the following code to get current user ID Token, it also very long.
try
{
var user = await Firebase.Auth.FirebaseAuth.Instance.SignInWithEmailAndPasswordAsync(email, password);
var uid = user.User.Uid;
var token = await user.User.GetIdTokenAsync(false);
return token.Token;
}
catch (FirebaseAuthInvalidUserException e)
{
e.PrintStackTrace();
return string.Empty;
}
You said that you want to get short ID Token, I guess that you want to get current user Uid
var uid = user.User.Uid;
Upvotes: 1