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

CheckAndRefreshAccessToken and refreshAccessToken typescript declaration is invalid #972

Open
tangb opened this issue Jun 21, 2022 · 3 comments
Labels

Comments

@tangb
Copy link

tangb commented Jun 21, 2022

Describe the bug
checkAndRefreshAccessToken and refreshAccessToken functions return a promise and not void.
The consequence is call to this function cannot be blocking and create issue when calling getAccessToken that returns undefined or an obsolete token.

Here is the declaration in types/index.d.ts, we can see comment is correct but declaration not ;-)

  /**
   * Checks if a token is needed, can be refreshed and if the token is expired.
   * If so, attempts to refresh access token
   * @returns {Promise<*>}
   */
  checkAndRefreshAccessToken(): void;

Expected Behavior
Prototype should be

checkAndRefreshAccessToken(): Promise<void>;
refreshAccessToken(): Promise<void>;

Versions
Latest version v10.31.0 under typescript backend app (nestjs)

@tangb tangb added the bug label Jun 21, 2022
@greg-db
Copy link
Contributor

greg-db commented Jun 21, 2022

Thanks for the report. I'll ask the team to correct this.

@megagreg72
Copy link

I also have this issue. checkAndRefreshAccessToken works as expected, but only if I await it.

@greg-db
Copy link
Contributor

greg-db commented Sep 15, 2022

Thanks for the note. This is still open with the team.

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

No branches or pull requests

3 participants