Skip to content

Commit

Permalink
fix(authentication): facebook and google native login missing scopes (#…
Browse files Browse the repository at this point in the history
…887)

fix(authentication): native login expecting clientId in request params
fix(authentication): native login not using scope conditionally from params
  • Loading branch information
kkopanidis committed Jan 11, 2024
1 parent 9bbd18d commit 470798e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
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

0 comments on commit 470798e

Please sign in to comment.