I’m trying to use firebase locally for testing, but am unable to get the private key from web3auth for my user. I tried to implement the solution for a similar issue from @irux, (see here: Firebase locally · Web3Auth · Discussion #630 · GitHub) except with flutter instead of vue.
I have a dummy jwks endpoint that is identical to his.
I also have a custom verifier that points to that jwks endpoint and that checks for the aud claim only. I would show you the config for the custom verifier, but I am unable to access the details for some reason:
I sign the unsigned firebase token with the dart_jsonwebtoken package using HS256, and when I decode it, it is identical in structure to the token I get when I don’t use the emulator. dart_jsonwebtoken | Dart Package
But I still get the error that auth shares couldn’t be found.
Here are my details:
Create a jwk endpoint using the public key on this website, or any tool. Set the public use to signing and algo to RS256, I set the key id to “id”. JWK Creator
Take that jwk, and upload it to a public domain, make sure that it’s something easy to change. We made the mistake of putting it on a storage bucket, but those urls can’t be updated, which means you will need to create a new custom verifier, which can take 30 mins - 1.5 hours.
Create a verifier that points to your jwk endpoint with the aud and iss values set to the same values for your cloud firebase instance. We set
JWT Verifier Id = sub,
jwk endpoint = yourendpoint.com/yourjwks.json
jwt validation: {
aud: your-project-id
iss: https://securetoken.google.com/your-project-id
}
In your flutter code, make sure to get your unsigned firebase id token as usual, but then sign it with this method. We used dart_jsonwebtoken (dart_jsonwebtoken | Dart Package) to sign the jwt.