feat: Remove returning token from customer and user endpoints (#7523)

* chore: Move generateJwtToken to utils

* feat: Stop returning token on user and customer endpoints
This commit is contained in:
Stevche Radevski
2024-05-29 17:13:01 +02:00
committed by GitHub
parent e5e5eb6e18
commit aeda24265d
14 changed files with 32 additions and 64 deletions
+1 -21
View File
@@ -10,7 +10,6 @@ import {
MedusaResponse,
} from "../../../types/routing"
import { refetchUser } from "./helpers"
import { generateJwtToken } from "../../utils/auth/token"
export const GET = async (
req: AuthenticatedMedusaRequest,
@@ -57,32 +56,13 @@ export const POST = async (
const { result } = await createUserAccountWorkflow(req.scope).run(input)
const { http } = req.scope.resolve(
ContainerRegistrationKeys.CONFIG_MODULE
).projectConfig
const { jwtSecret, jwtExpiresIn } = http
const token = generateJwtToken(
{
actor_id: result.id,
actor_type: "user",
auth_identity_id: req.auth_context.auth_identity_id,
app_metadata: {
user_id: result.id,
},
},
{
secret: jwtSecret,
expiresIn: jwtExpiresIn,
}
)
const user = await refetchUser(
result.id,
req.scope,
req.remoteQueryConfig.fields
)
res.status(200).json({ user, token })
res.status(200).json({ user })
}
export const AUTHENTICATE = false