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

[RFC]: AuthContextInterface should support passing options to getToken #11917

Open
1 task done
Philzen opened this issue Jan 22, 2025 · 0 comments · May be fixed by #11918
Open
1 task done

[RFC]: AuthContextInterface should support passing options to getToken #11917

Philzen opened this issue Jan 22, 2025 · 0 comments · May be fixed by #11918

Comments

@Philzen
Copy link
Contributor

Philzen commented Jan 22, 2025

Summary

When using an auth adapter such as Azure , getToken takes an option argument:

getToken: async (options?: SilentRequest) => {
// Default scopes if options is not passed
const request = options || {
scopes: ['openid', 'profile'],
}

Clerk also takes in an options argument for getToken.

However, the current AuthContextInterface implementation does not support this on getToken (while many other methods in this interface allow arguments that are typed via generics):

getToken(): Promise<null | string>

Motivation

The current type will therefore lead to a typescript error when trying to use the (existing) argument (i.e. in Azure):

Image

Detailed proposal

Add another generic TGetTokenOptions here:

export interface AuthContextInterface<
TUser,
TLogInOptions,
TLogIn,
TLogOutOptions,
TLogOut,
TSignUpOptions,
TSignUp,
TForgotPassword,
TResetPasswordOptions,
TResetPassword,
TValidateResetToken,
TClient,
> {

and change the getToken type to:

  getToken(options?: TGetTokenOptions): Promise<null | string>

Are you interested in working on this?

  • I'm interested in working on this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant