🏷️ Make OAuth2ProviderConfig.scope and params optional for better type inference in client applications

This commit is contained in:
Dan6erbond 2021-05-25 10:06:34 +02:00
parent 1b3c804590
commit d64d9f1807

View File

@ -10,10 +10,10 @@ export interface OAuth2ProviderConfig<ProfileType = any, TokensType extends OAut
profileUrl?: string;
clientId?: string;
clientSecret?: string;
scope: string | string[];
scope?: string | string[];
headers?: any;
authorizationParams?: any;
params: any;
params?: any;
grantType?: string;
responseType?: string;
contentType?: "application/json" | "application/x-www-form-urlencoded";
@ -43,7 +43,7 @@ export class OAuth2Provider<
nonce,
response_type: this.config.responseType,
client_id: this.config.clientId,
scope: Array.isArray(this.config.scope) ? this.config.scope.join(" ") : this.config.scope,
scope: Array.isArray(this.config.scope) ? this.config.scope.join(" ") : this.config.scope!,
redirect_uri: this.getCallbackUri(auth, host),
...(this.config.authorizationParams ?? {}),
};