Feat(auth): Remove auth provider entity (#6314)

**What**
- remove auth provider entity

**Why**
- The auth provider entity was not really used anywhere

**How**
- Keeping loader behavior as is but removing the 

Co-authored-by: Sebastian Rindom <7554214+srindom@users.noreply.github.com>
This commit is contained in:
Philip Korsholm
2024-02-06 07:54:34 +00:00
committed by GitHub
co-authored by Sebastian Rindom
parent b2eaac8cb1
commit 882aa549bd
37 changed files with 179 additions and 1223 deletions
@@ -1,26 +1,33 @@
import { IAuthModuleService, ICustomerModuleService } from "@medusajs/types"
import { CreateCustomerDTO, MedusaContainer } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import jwt from "jsonwebtoken"
export const createAuthenticatedCustomer = async (
customerModuleService: ICustomerModuleService,
authService: IAuthModuleService,
jwtSecret: string
appContainer: MedusaContainer,
customerData: Partial<CreateCustomerDTO> = {}
) => {
const { jwt_secret } = appContainer.resolve("configModule").projectConfig
const authService = appContainer.resolve(ModuleRegistrationName.AUTH)
const customerModuleService = appContainer.resolve(
ModuleRegistrationName.CUSTOMER
)
const customer = await customerModuleService.create({
first_name: "John",
last_name: "Doe",
email: "john@me.com",
...customerData,
})
const authUser = await authService.createAuthUser({
const authUser = await authService.create({
entity_id: "store_user",
provider: "emailpass",
scope: "store",
app_metadata: { customer_id: customer.id },
})
const token = jwt.sign(authUser, jwtSecret)
const token = jwt.sign(authUser, jwt_secret)
return { customer, authUser, jwt: token }
}