Skip to content

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

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

Open
1 task done
Philzen opened this issue Jan 22, 2025 · 0 comments
Open
1 task done

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

Philzen opened this issue Jan 22, 2025 · 0 comments

Comments

@Philzen
Copy link
Contributor

Philzen commented Jan 22, 2025

Summary

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

https://github.com/redwoodjs/redwood/blob/231e1f9da81c1d779000397895b2636430742821/packages/auth-providers/azureActiveDirectory/web/src/azureActiveDirectory.ts#L40-L44

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):

https://github.com/redwoodjs/redwood/blob/231e1f9da81c1d779000397895b2636430742821/packages/auth/src/AuthContext.ts#L54

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:

https://github.com/redwoodjs/redwood/blob/231e1f9da81c1d779000397895b2636430742821/packages/auth/src/AuthContext.ts#L7-L20

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