dropbox-sdk-js icon indicating copy to clipboard operation
dropbox-sdk-js copied to clipboard

CheckAndRefreshAccessToken and refreshAccessToken typescript declaration is invalid

Open tangb opened this issue 2 years ago • 3 comments

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 avatar Jun 21 '22 09:06 tangb

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

greg-db avatar Jun 21 '22 17:06 greg-db

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

megagreg72 avatar Sep 15 '22 17:09 megagreg72

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

greg-db avatar Sep 15 '22 18:09 greg-db