Over on GitHub a helpful Google dev told me that
to create a user session, your python backend server only needs a JWT library to verify the Firebase Auth token (signature and audience) in the request and extract the user info from the token payload.
I am having trouble with verifying the token.
This is where I'm at; In order to start the migration I proceeded as follows:
I added Firebase-Auth to the Android App, while still having Gitkit in the App until Firebase-Auth works. Now I have two sign-in buttons, one which signs in into Firebase and one for the "almost deprecated" Gitkit.
On firebase.com I imported the Google project into a new Firebase Project, so the user database is the same. I've already managed to use Firebase-Auth in the Android App, am able to log-in as a known user and I can successfully retrieve the token which I will need for my backend server by calling
mFirebaseAuth.getCurrentUser().getToken(false).getResult().getToken()
. It contains the sameuser_id
as the GitKit token.
Now I'm attempting to replace the identity-toolkit-python-client
library with python-jose
. Since I'm currently not sending the Firebase token to the backend, but only the Gitkit token, I want to test this python-jose
library on the Gitkit token.
On the backend, before calling GitKit.VerifyGitkitToken()
i'm now printing out the results of jose.jwt.get_unverified_header()
and jose.jwt.get_unverified_claims()
in order to check if I get to see what I expect. The results are good, I am able to view the content of the Gitkit token just as expected.
My problem comes with the verification. I'm unable to use jose.jwt.decode()
for verification because I don't know which key I need to use.
jose.jwt.decode(token, key, algorithms=None, options=None, audience=None, issuer=None, subject=None, access_token=None)
I know the algorithm from the header and an 'aud' field is also stored in the claims, if that is of any help.
Getting back to the engineers comment
verify the Firebase Auth token (signature and audience)
How do I do that with the info I have avaliable? I guess audience is the 'aud' field in the claims, but how do I check the signature?
Once I've removed the Gitkit dependency on the server, I will continue with the migration.
From what I've seen, the GitKit library apparently makes an "RPC" call to a Google server for verification, but I may be wrong.
So, which will be the key for Gitkit token verification as well as the one for the Firebase token verification?