Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

KazuumiN
Copy link

@KazuumiN KazuumiN commented Apr 2, 2024

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
Copy link
Author

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...

Copy link
Owner

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

Copy link
Author

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.

Suggested change
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.

accessTokenExpiresAt?: Date;

Copy link
Owner

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

Copy link
Author

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😄

@@ -0,0 +1,3 @@
```
Copy link
Owner

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 :)

Copy link
Author

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 {
Copy link
Owner

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.

https://api.slack.com/authentication/rotation#refresh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants