-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
getNewAccessTokenUsingRefreshToken should return OAuth2Token instance but doesn't #145
Comments
After some investigation on the code, I believe the issue lies in this line: const accessToken = fastify[name].oauth2.accessToken.create({ refresh_token: refreshToken }) [ Per the simple-oauth2 package readme file, I would expect to see something more under the lines of: async function run() {
const accessTokenJSONString = await getPersistedAccessTokenJSON();
let accessToken = client.createToken(JSON.parse(accessTokenJSONString));
}
run(); Where |
Did you inspect the getNewAccessTokenUsingRefreshToken 's |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This still happens, also they differ in the return values like expires_in and expires_at
getNewAccessTokenUsingRefreshToken
|
Prerequisites
Fastify version
3.27.4
Plugin version
4.5.0
Node.js version
16.14.2
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
12.3.1
Description
While trying to implement the feature letting me refresh my Google access_token using the previously emitted refresh_token using
getNewAccessTokenUsingRefreshToken()
method and when I try to get it back to the client, I receive an error stating we're trying to stringify a circular JSON object while we expect to have a OAuth2Token instance.Steps to Reproduce
Expected Behavior
I expect to receive a Oauth2Token instance (if the refresh token is obviously correct) that would have the following structure:
export interface OAuth2Token {
token_type: 'bearer';
access_token: string;
refresh_token?: string;
expires_in: number;
}
The text was updated successfully, but these errors were encountered: