-
Notifications
You must be signed in to change notification settings - Fork 974
Implement Token refresh mechanism for BYO-CIAM #9285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gcip-byociam-web
Are you sure you want to change the base?
Conversation
|
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1This report is too large (377,964 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.Test Logs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if ( | ||
firebaseToken && | ||
firebaseToken.expirationTime && | ||
Date.now() > firebaseToken.expirationTime - this.TOKEN_EXPIRATION_BUFFER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function doesn't look correct to me.
- Currently, it will return true if firebaseToken is null or undefined. This is not the expected behavior, isn't it?
- Should it be
>=
? The token should be invalid when it's at exactly the expiration time, right? - firebaseToken.expirationTime is a string, right? Do we need to parse it to Date to compare?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thank you for the suggestion!
- Updated the logic to return
false
if firebaseToken is null or firebaseToken.expirationTime is null. - Updated!
- firebaseToken.expirationTime is a number - https://github.com/firebase/firebase-js-sdk/blob/gcip-byociam-web/packages/auth/src/model/public_types.ts#L981. Therefore, parsing to a Date object isn't necessary IMO.
Please let me know if you see any further concerns.
PasswordValidationStatus, | ||
TenantConfig, | ||
FirebaseToken | ||
FirebaseToken, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Out of scope of this PR] Curious - Have we addressed the following concern?
"firebaseToken" is a really generic name -- "Firebase" is a huge suite of products that has many different types of tokens. Any and every change to the public API surface needs to go through review
Implement Token refresh mechanism for BYO-CIAM.
API Proposal - http://goto.google.com/byociam-token-refresh-api-proposal
Testing