firebase_id_token icon indicating copy to clipboard operation
firebase_id_token copied to clipboard

Doc suggestion for tests

Open littletime opened this issue 2 years ago • 0 comments

Hi,

I've been struggling today with the implementation of my tests with rspec, which would not pass even using the FirebaseIdToken.test! and the pretty cool code snippet explaining how to generate a token in test mode.

In order for the FirebaseIdToken::Signature.verify method to return a payload, it has to be valid, which implies 4 things to be in order in the test payload that's encrypted for token generation:

  • iat timestamp value before the test running time
  • exp timestamp value after the test running time
  • aud string to contain the project id
  • iss string to contain a url that depends on the project id

This error is invisible when testing with custom payload that's not a Google-generated token from actual firebase project.

It would be nice to add in the Test section of the documentation something that reminds of those requirements for a valid test payload.

littletime avatar Sep 12 '22 20:09 littletime