-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
feat: add slack refresh token function #98
base: main
Are you sure you want to change the base?
Conversation
KazuumiN
commented
Apr 2, 2024
•
edited
Loading
edited
- Token rotation
- openid.connect.token
src/providers/slack.ts
Outdated
idToken: result.id_token | ||
idToken: result.id_token, | ||
refreshToken: result.refresh_token ?? null, | ||
accessTokenExpiresAt: typeof result.expires_in !== "undefined" && createDate(new TimeSpan(result.expires_in, "s")) || undefined |
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 line is quite strange, but I found that expires_in
field didn't appeared when I didn't use token rotation...
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.
I think that's expected since without token exchange, the access token last indefinitely. Should be null
instead of undefined
tho
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.
Thanks. That makes sense.
If I understood correctly, I'll change like this.
accessTokenExpiresAt: typeof result.expires_in !== "undefined" && createDate(new TimeSpan(result.expires_in, "s")) || undefined | |
accessTokenExpiresAt: typeof result.expires_in !== "undefined" && createDate(new TimeSpan(result.expires_in, "s")) || null |
And in this case, should I also change the accessTokenExpiresAt
field in Token
type too? Since it doesn't accept null type.
Line 107 in 69afa38
accessTokenExpiresAt?: Date; |
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.
Didn't realize that! Yeah the type declaration should be updated to allow null
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.
Thanks! I re-request review😄
Co-authored-by: pilcrow <[email protected]>
.changesets/vnlwb.minor.md
Outdated
@@ -0,0 +1,3 @@ | |||
``` |
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.
You can remove the code fence :)
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.
😳
expires_in?: number; | ||
} | ||
|
||
interface RefreshTokenResponseBody { |
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.
Does it not create a new refresh token?
Use the new refresh_token when you need to refresh the tokens once again.