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

Use new this() instead of new OAuth2Strategy() in the static discover() function #147

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

ezraripps
Copy link
Contributor

This solves an issue where strategies that extend OAuth2Strategy cannot use the discover() method, as it will construct the base class and not the one extending it.

export class CustomOauthStrategy extends OAuth2Strategy {
	protected authorizationParams(params: URLSearchParams): URLSearchParams {
	  	params.set('custom_param', 'value');
	  	return(params);
	}
}

const strategy = await CustomOauthStrategy.discover(...); // This will be OAuth2Strategy, not CustomOauthStrategy

// Thus, CustomOauthStrategy.authorizationParams will never be called

@sergiodxa sergiodxa changed the title Use new this( instead of new OAuth2Strategy( in discover() function Use new this() instead of new OAuth2Strategy() in the static discover() function Dec 10, 2024
@ezraripps
Copy link
Contributor Author

@sergiodxa Any updates?

@sergiodxa sergiodxa merged commit d3b298c into sergiodxa:main Dec 16, 2024
1 check passed
@sergiodxa sergiodxa self-assigned this Dec 16, 2024
@sergiodxa sergiodxa added the enhancement New feature or request label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants