Skip to content

How to detect when a token refresh was made #2294

Answered by gr2m
ofhouse asked this question in Q&A
Discussion options

You must be logged in to vote

Sounds like a good idea, can you open an issue in https://github.com/octokit/auth-oauth-user.js for the feature request, and include your use case?

For the time being, you can workaround by using the @octokit/core SDK instead of the @octokit/graphql function. It won't add a lot of code, we keep the core SDK intentionally very lightweight. Using the core SDK will give you hooks, which you could use to hook into the request life cycle, and each time a token was refreshed / created, you could save it to your database.

@octokit/auth-oauth-user already has an onVerification option, we could add a new onTokenCreated option, which could pass a flag whether it was a refresh or not?

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@ofhouse
Comment options

@gr2m
Comment options

@ofhouse
Comment options

Answer selected by ofhouse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants