diff --git a/packages/medusa-plugin-auth/src/auth-strategies/auth0/admin.ts b/packages/medusa-plugin-auth/src/auth-strategies/auth0/admin.ts index 71f0ec7..074bae3 100644 --- a/packages/medusa-plugin-auth/src/auth-strategies/auth0/admin.ts +++ b/packages/medusa-plugin-auth/src/auth-strategies/auth0/admin.ts @@ -80,4 +80,4 @@ export function getAuth0AdminAuthRouter(auth0: Auth0Options, configModule: Confi }, expiresIn: auth0.admin.expiresIn, }); -} \ No newline at end of file +} diff --git a/packages/medusa-plugin-auth/src/auth-strategies/azure-oidc/types.ts b/packages/medusa-plugin-auth/src/auth-strategies/azure-oidc/types.ts index 08f6caf..08cf180 100644 --- a/packages/medusa-plugin-auth/src/auth-strategies/azure-oidc/types.ts +++ b/packages/medusa-plugin-auth/src/auth-strategies/azure-oidc/types.ts @@ -1,5 +1,5 @@ import { MedusaContainer } from '@medusajs/medusa/dist/types/global'; -import {AuthOptions} from "../../types"; +import { AuthOptions } from '../../types'; export const AZURE_STORE_STRATEGY_NAME = 'azure-oidc.store.medusa-auth-plugin'; export const AZURE_ADMIN_STRATEGY_NAME = 'azure-oidc.admin.medusa-auth-plugin'; @@ -88,7 +88,12 @@ export type AzureAuthOption = { /** * The default verify callback function will be used if this configuration is not specified */ - verifyCallback?: (container: MedusaContainer, req: Request, profile: any, strict?: AuthOptions['strict']) => Promise; + verifyCallback?: ( + container: MedusaContainer, + req: Request, + profile: any, + strict?: AuthOptions['strict'] + ) => Promise; expiresIn?: number; }; diff --git a/packages/medusa-plugin-auth/src/auth-strategies/facebook/types.ts b/packages/medusa-plugin-auth/src/auth-strategies/facebook/types.ts index 699fdc2..9a91eed 100644 --- a/packages/medusa-plugin-auth/src/auth-strategies/facebook/types.ts +++ b/packages/medusa-plugin-auth/src/auth-strategies/facebook/types.ts @@ -1,5 +1,5 @@ import { MedusaContainer } from '@medusajs/medusa/dist/types/global'; -import {AuthOptions} from "../../types"; +import { AuthOptions } from '../../types'; export const FACEBOOK_ADMIN_STRATEGY_NAME = 'facebook.admin.medusa-auth-plugin'; export const FACEBOOK_STORE_STRATEGY_NAME = 'facebook.store.medusa-auth-plugin'; diff --git a/packages/medusa-plugin-auth/src/auth-strategies/firebase/utils.ts b/packages/medusa-plugin-auth/src/auth-strategies/firebase/utils.ts index c0fd411..809c93f 100644 --- a/packages/medusa-plugin-auth/src/auth-strategies/firebase/utils.ts +++ b/packages/medusa-plugin-auth/src/auth-strategies/firebase/utils.ts @@ -6,7 +6,7 @@ import { authenticateSessionFactory, signToken } from '../../core/auth-callback- function firebaseCallbackMiddleware(domain: 'admin' | 'store', configModule: ConfigModule, expiresIn?: number) { return (req: Request, res: Response) => { - if(req.query.returnAccessToken == 'true') { + if (req.query.returnAccessToken == 'true') { const token = signToken(domain, configModule, req.user, expiresIn); res.json({ access_token: token }); return; diff --git a/packages/medusa-plugin-auth/src/core/auth-callback-middleware.ts b/packages/medusa-plugin-auth/src/core/auth-callback-middleware.ts index 03919d3..06c4095 100644 --- a/packages/medusa-plugin-auth/src/core/auth-callback-middleware.ts +++ b/packages/medusa-plugin-auth/src/core/auth-callback-middleware.ts @@ -7,31 +7,21 @@ import jwt from 'jsonwebtoken'; * will be called. * @param successAction */ -export function authCallbackMiddleware( - successAction: (req: Request, res: Response) => void -) { +export function authCallbackMiddleware(successAction: (req: Request, res: Response) => void) { return (req, res) => { successAction(req, res); }; } export function signToken(domain: 'admin' | 'store', configModule: ConfigModule, user: any, expiresIn?: number) { - if(domain === 'admin') { - return jwt.sign( - { user_id: user.id, domain: 'admin' }, - configModule.projectConfig.jwt_secret, - { + if (domain === 'admin') { + return jwt.sign({ user_id: user.id, domain: 'admin' }, configModule.projectConfig.jwt_secret, { expiresIn: expiresIn ?? '24h', - } - ); + }); } else { - return jwt.sign( - { customer_id: user.id, domain: 'store' }, - configModule.projectConfig.jwt_secret, - { - expiresIn: expiresIn ?? '30d', - } - ); + return jwt.sign({ customer_id: user.id, domain: 'store' }, configModule.projectConfig.jwt_secret, { + expiresIn: expiresIn ?? '30d', + }); } }