feat: Separate registration from authentication in auth domain (#8683)
* wip * feat: Introduce register * fix: user command * fix: Invite HTTP tests * fix: Auth tests * fix: Invite modules tests
This commit is contained in:
@@ -121,6 +121,20 @@ export default class AuthModuleService
|
||||
return Array.isArray(data) ? serializedUsers : serializedUsers[0]
|
||||
}
|
||||
|
||||
async register(
|
||||
provider: string,
|
||||
authenticationData: AuthenticationInput
|
||||
): Promise<AuthenticationResponse> {
|
||||
try {
|
||||
return await this.authProviderService_.register(
|
||||
provider,
|
||||
authenticationData,
|
||||
this.getAuthIdentityProviderService(provider)
|
||||
)
|
||||
} catch (error) {
|
||||
return { success: false, error: error.message }
|
||||
}
|
||||
}
|
||||
// @ts-expect-error
|
||||
createProviderIdentities(
|
||||
data: AuthTypes.CreateProviderIdentityDTO[],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
AuthIdentityProviderService,
|
||||
AuthTypes,
|
||||
AuthenticationInput,
|
||||
AuthIdentityProviderService,
|
||||
AuthenticationResponse,
|
||||
} from "@medusajs/types"
|
||||
import { MedusaError } from "@medusajs/utils"
|
||||
@@ -42,6 +42,15 @@ export default class AuthProviderService {
|
||||
return await providerHandler.authenticate(auth, authIdentityProviderService)
|
||||
}
|
||||
|
||||
async register(
|
||||
provider: string,
|
||||
auth: AuthenticationInput,
|
||||
authIdentityProviderService: AuthIdentityProviderService
|
||||
): Promise<AuthenticationResponse> {
|
||||
const providerHandler = this.retrieveProviderRegistration(provider)
|
||||
return await providerHandler.register(auth, authIdentityProviderService)
|
||||
}
|
||||
|
||||
async validateCallback(
|
||||
provider: string,
|
||||
auth: AuthenticationInput,
|
||||
|
||||
Reference in New Issue
Block a user