firebase / firebase/firebase-js-sdk

ID token docs say refreshes with 5 minutes buffer but seems to be 30 seconds

Open
#8,165 5 comments 2 reactions 0 assignees View on GitHub
api: auth needs-attention question
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### Operating System

Any

### Browser Version

Any

### Firebase SDK Version

92e2279a299dbe88e01bf7ed3da4be42d4de86c9

### Firebase SDK Product:

Auth

### Describe your project's tooling

This report is based on examining the code in GitHub and not an actual direct usage. We noticed expired tokens being sent to our backend and investigated the code and found this.

### Describe the problem

The documentation says that firebase ID tokens should be refreshed if they would expires within 5 minutes.

https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/src/core/user/id_token_result.ts#L31

But looking at the code that actually fetches, it appears to use a buffer that is 30s

https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/src/core/user/token_manager.ts#L49

Is this intended or is it missing a `0` accidentally?

### Steps and code to reproduce issue

We don't have a direct reproduction but notice expired tokens being sent to our backend (no request takes more than 5 minutes to process) and examined the code to see why it may be.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.