dart_firebase_admin
dart_firebase_admin copied to clipboard
createCustomToken generates invalid Token
When i send the token back to the client and trie the LoginWithToken method I get: error: [firebase_auth/invalid-custom-token] The custom token format is incorrect. Please check the documentation.
If i paste the token into jwt.io i get the following warning (although I can see the correct payload of the token. Warning: Looks like your JWT signature is not encoded correctly using base64url (https://tools.ietf.org/html/rfc4648#section-5). Note that padding ("=") must be omitted as per https://tools.ietf.org/html/rfc7515#section-2
I did double check that the projects match and got it to work with the python admin sdk.
Any Ideas?
Thanks Mark
When i send the token back to the client and trie the LoginWithToken method I get:
What does that mean exactly? Maybe some code samples would help here
Of course so my workflow is:
-
HTTP Request to Dart Backend (DartFrog) to get the token
-
On the Server Endpoint I have the following code to generate the token
auth.createCustomToken(uid, developerClaims: {'role': 'm1_admin'}); -
On the client I use the token I genereated in step 2 to sign in with the flutter client sdk:
FirebaseAuth.instance.signInWithCustomToken(token);
This is where I get the error: error: [firebase_auth/invalid-custom-token] The custom token format is incorrect. Please check the documentation.
I'm also having this issue, I'm just using the createCustomToken without any claims and I can't use the token with the signInWithCustomToken endpoint. Same error about the formatting
I think #23 fixes this issue. Worked fine for me when I tested a few hours ago.
@rrousselGit
Hello!
In the following PR:
https://github.com/invertase/dart_firebase_admin/pull/23
the reproducible code sample about this issue is described, and I tried to solve it.
I would greatly appreciate if you have a look at the PR, as some time has passed.
Thank you!
Are there any reasons why hasn't been merged yet? The PR changes are working fine.
Should be fixed by the next release