arao6
arao6

Reputation: 3376

Get UID from expired Firebase auth token?

For a valid token, we can call admin.auth().verifyIdToken(...). We have a specific case where the token we receive may have expired, but it is not sensitive data so we'd still like to determine the UID behind the expired token. verifyIdToken() throws an exception when the token has expired. Is it possible to determine the UID behind an expired token as well as determine when it expired?

Upvotes: 1

Views: 184

Answers (1)

Hiranya Jayathilaka
Hiranya Jayathilaka

Reputation: 7438

Decode the ID token using any JWT library, and check the sub claim.

Upvotes: 1

Related Questions