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

Deprecate AccessTokenAdapter.toAuthorizationCallback #278

Open
karolis-zukauskas opened this issue Nov 19, 2024 · 0 comments
Open

Deprecate AccessTokenAdapter.toAuthorizationCallback #278

karolis-zukauskas opened this issue Nov 19, 2024 · 0 comments
Labels
invalid This doesn't seem right

Comments

@karolis-zukauskas
Copy link

AccessTokenAdapter.toAuthorizationCallback does not do what it is supposed to be doing - it should be deprecated to prevent further misuse.

This function returns a function that always returns the same accessToken (which is pointless). Instead, you want a function that might return a new accessToken if the old one expires.

The following code is correct for an authorization parameter:

const authorization = async () => {
  const token = await IModelApp.getAccessToken();

  return AccessTokenAdapter.toAuthorization(token);
}

This is wrong:

const accessToken = await IModelApp.getAccessToken();
const authorization = AccessTokenAdapter.toAuthorizationCallback(accessToken);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant