@shopify/shopify-app-express
Version:
Shopify Express Middleware - to simplify the building of Shopify Apps with Express
1 lines • 1.52 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","sources":["../../../../src/auth/index.ts"],"sourcesContent":["import {NextFunction, Request, RequestHandler, Response} from 'express';\n\nimport {ApiAndConfigParams} from '../types';\nimport {redirectToAuth} from '../redirect-to-auth';\n\nimport {authCallback} from './auth-callback';\nimport {AuthMiddleware} from './types';\n\nexport function auth({api, config}: ApiAndConfigParams): AuthMiddleware {\n return {\n begin(): RequestHandler {\n return async (req: Request, res: Response) =>\n redirectToAuth({req, res, api, config});\n },\n callback(): RequestHandler {\n return async (req: Request, res: Response, next: NextFunction) => {\n config.logger.info('Handling request to complete OAuth process');\n\n const oauthCompleted = await authCallback({\n req,\n res,\n api,\n config,\n });\n\n if (oauthCompleted) {\n next();\n }\n };\n },\n };\n}\n"],"names":[],"mappings":";;;SAQgB,IAAI,CAAC,EAAC,GAAG,EAAE,MAAM,EAAqB,EAAA;IACpD,OAAO;QACL,KAAK,GAAA;YACH,OAAO,OAAO,GAAY,EAAE,GAAa,KACvC,cAAc,CAAC,EAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAC,CAAC;QAC3C,CAAC;QACD,QAAQ,GAAA;YACN,OAAO,OAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,KAAI;AAC/D,gBAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC;AAEhE,gBAAA,MAAM,cAAc,GAAG,MAAM,YAAY,CAAC;oBACxC,GAAG;oBACH,GAAG;oBACH,GAAG;oBACH,MAAM;AACP,iBAAA,CAAC;gBAEF,IAAI,cAAc,EAAE;AAClB,oBAAA,IAAI,EAAE;gBACR;AACF,YAAA,CAAC;QACH,CAAC;KACF;AACH;;;;"}