fix: Check actor type on account creation, fix github entity id (#8996)

This commit is contained in:
Stevche Radevski
2024-09-04 17:23:31 +02:00
committed by GitHub
parent de6f61b05f
commit ed26fb4d19
3 changed files with 8 additions and 3 deletions

View File

@@ -59,7 +59,7 @@ export class Auth {
this.client.setToken(token as string)
}
return token
return token as string
}
// The callback expects all query parameters from the Oauth callback to be passed to the backend, and the provider is in charge of parsing and validating them

View File

@@ -87,7 +87,12 @@ export const authenticate = (
}
// If the entity is authenticated, but there is no registered actor yet, we can continue (eg. in the case of a user invite) if allow unregistered is set
if (authContext?.auth_identity_id && options.allowUnregistered) {
// We also don't want to allow creating eg. a customer with a token created for a `user` provider.
if (
authContext?.auth_identity_id &&
options.allowUnregistered &&
actorTypes.includes(authContext?.actor_type)
) {
req_.auth_context = authContext
return next()
}

View File

@@ -148,7 +148,7 @@ export class GithubAuthService extends AbstractAuthModuleProvider {
},
}).then((r) => r.json())
const entity_id = user.id
const entity_id = user.id.toString()
const userMetadata = {
profile_url: user.url,
avatar: user.avatar_url,