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

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

No files matched your search

+1 -1
View File
@@ -59,7 +59,7 @@ export class Auth {
this.client.setToken(token as string) 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 // 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
@@ -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 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 req_.auth_context = authContext
return next() return next()
} }
@@ -148,7 +148,7 @@ export class GithubAuthService extends AbstractAuthModuleProvider {
}, },
}).then((r) => r.json()) }).then((r) => r.json())
const entity_id = user.id const entity_id = user.id.toString()
const userMetadata = { const userMetadata = {
profile_url: user.url, profile_url: user.url,
avatar: user.avatar_url, avatar: user.avatar_url,