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

fix: keeps expiresAt with token if present #50

Merged
merged 1 commit into from
Oct 5, 2021

Conversation

baoshan
Copy link
Contributor

@baoshan baoshan commented Sep 29, 2021

When token expiration applies, return values with a token should comes with an expiresAt.

Documentation of below GitHub APIs indicates an expires_at property may show up in the response data:

@ghost ghost added this to Inbox in JS Sep 29, 2021
@ghost ghost moved this from Inbox to Awaiting response in JS Sep 30, 2021
@ghost ghost moved this from Awaiting response to Bugs in JS Sep 30, 2021
src/scope-token.ts Outdated Show resolved Hide resolved
src/types.ts Outdated
Comment on lines 14 to 39
expiresAt?: string;
};

export type GitHubAppAuthenticationWithExpiration = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should rename the GitHubAppAuthenticationWithExpiration type to GitHubAppAuthenticationWithRefreshToken in order to make the distinction clear now that we added expiresAt? to GitHubAppAuthentication?

We should however keep the GitHubAppAuthenticationWithExpiration type because other @octokit/ packages now dependon it, but we could mark it as @deprecated, until the next breaking version.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I @deprecated both GitHubAppAuthentication and GitHubAppAuthenticationWithExpiration (with their original definition untouched) and introduced:

  1. GitHubAppAuthenticationWithExpirationEnabled
  2. GitHubAppAuthenticationWithExpirationDisabled
  3. GitHubAppAuthenticationWithRefreshToken

Once the types defined in different modules are crystallize, can we try to refactor (and unify) them into octokit/types? I’m not familiar with the existing design so I’m not very confident that the PR is consistent with the big picture.

Please let me know if it doesn’t look good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, thanks a lot!

We do a big revamp of how the types work at https://github.com/octokit/octokit-next.js, I'll make sure to adapt the new naming there once we get to it.

We can update the types at other projects that import them but it's not critical.

Copy link
Contributor

@gr2m gr2m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@gr2m gr2m merged commit 4d86a2d into octokit:main Oct 5, 2021
JS automation moved this from Bugs to Done Oct 5, 2021
@github-actions
Copy link

github-actions bot commented Oct 5, 2021

🎉 This PR is included in version 1.2.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

2 participants