firestore-db-and-auth-rs icon indicating copy to clipboard operation
firestore-db-and-auth-rs copied to clipboard

Access tokens created from UserSession::by_user_id cannot be used with UserSession::by_access_token

Open kdy1 opened this issue 4 years ago • 0 comments

Describe the bug

The code below

     let sess = UserSession::by_user_id(&cred, &format!("test_{}", uid), false)
        .expect("failed to create a user session");

    let token = sess.access_token();
    UserSession::by_access_token(&cred, &token).expect("invalid test token");

panic with invalid test token: Generic("No secret for kid")

The header of created jwt is

{
  "alg": "RS256",
  "kid": "tB0M2A"
}

To Reproduce Steps to reproduce the behavior:

  1. Create an access token with UserSession::by_user_id
  2. Pass the access token to UserSession::by_access_token

Expected behavior Works without any issue.

kdy1 avatar Jun 10 '21 08:06 kdy1