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

fix(authentication): facebook and google native login missing scopes #887

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions modules/authentication/src/handlers/oauth2/OAuth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,11 @@ export abstract class OAuth2<T, S extends OAuth2Settings>

async authenticate(call: ParsedRouterRequest): Promise<UnparsedRouterResponse> {
ConduitGrpcSdk.Metrics?.increment('login_requests_total');
const scopes = call.request.params?.scopes ?? this.defaultScopes;
const payload = await this.connectWithProvider({
accessToken: call.request.params['access_token'],
clientId: call.request.params['clientId'],
scope: call.request.params?.scope,
clientId: this.settings.clientId,
scope: scopes,
});
const user = await this.createOrUpdateUser(
payload,
Expand All @@ -190,7 +191,7 @@ export abstract class OAuth2<T, S extends OAuth2Settings>

return TokenProvider.getInstance().provideUserTokens({
user,
clientId: call.request.params['clientId'],
clientId: this.settings.clientId,
config,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class FacebookHandlers extends OAuth2<FacebookUser, OAuth2Settings> {
access_token: ConduitString.Required,
invitationToken: ConduitString.Optional,
captchaToken: ConduitString.Optional,
scopes: [ConduitString.Optional],
},
},
new ConduitRouteReturnDefinition('FacebookResponse', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class GoogleHandlers extends OAuth2<GoogleUser, OAuth2Settings> {
expires_in: ConduitString.Optional,
invitationToken: ConduitString.Optional,
captchaToken: ConduitString.Optional,
scopes: [ConduitString.Optional],
},
},
new ConduitRouteReturnDefinition('GoogleResponse', {
Expand Down
Loading