feat(medusa-react,medusa,utils): add users/me endpoint + add missing specs (#6441)
**what:** - adds /me endpoint - adds fixes to routes - adds specs for auth endpoint - updates dotenv package versions Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
This commit is contained in:
co-authored by
Philip Korsholm
parent
883cb0dca7
commit
8dad2b51a2
@@ -1,16 +1,13 @@
|
||||
import { AuthUserDTO } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
||||
import { ApiKeyDTO, AuthUserDTO, IApiKeyModuleService } from "@medusajs/types"
|
||||
import { stringEqualsOrRegexMatch } from "@medusajs/utils"
|
||||
import { NextFunction, RequestHandler } from "express"
|
||||
import jwt, { JwtPayload } from "jsonwebtoken"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../types/routing"
|
||||
import { NextFunction, RequestHandler } from "express"
|
||||
import jwt, { JwtPayload } from "jsonwebtoken"
|
||||
|
||||
import { stringEqualsOrRegexMatch } from "@medusajs/utils"
|
||||
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
||||
import { IApiKeyModuleService } from "@medusajs/types"
|
||||
import { ApiKeyDTO } from "@medusajs/types"
|
||||
|
||||
const SESSION_AUTH = "session"
|
||||
const BEARER_AUTH = "bearer"
|
||||
@@ -68,6 +65,7 @@ export const authenticate = (
|
||||
}
|
||||
|
||||
const isMedusaScope = isAdminScope(authScope) || isStoreScope(authScope)
|
||||
|
||||
const isRegistered =
|
||||
!isMedusaScope ||
|
||||
(authUser?.app_metadata?.user_id &&
|
||||
@@ -85,6 +83,7 @@ export const authenticate = (
|
||||
app_metadata: authUser.app_metadata,
|
||||
scope: authUser.scope,
|
||||
}
|
||||
|
||||
return next()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user