From a720d5a5d58df0339bee7807338eea1e15046720 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Sun, 28 Aug 2022 09:48:39 -0700 Subject: [PATCH] set cors config for android web redirect --- .../api/src/routers/auth/mobile/mobile_auth_router.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/api/src/routers/auth/mobile/mobile_auth_router.ts b/packages/api/src/routers/auth/mobile/mobile_auth_router.ts index 7bd0c20e9..c43df9bc8 100644 --- a/packages/api/src/routers/auth/mobile/mobile_auth_router.ts +++ b/packages/api/src/routers/auth/mobile/mobile_auth_router.ts @@ -12,6 +12,8 @@ import { } from './sign_up' import { createMobileAccountCreationResponse } from './account_creation' import { env } from '../../../env' +import { corsConfig } from '../../../utils/corsConfig' +import cors from 'cors' export function mobileAuthRouter() { const router = express.Router() @@ -61,6 +63,12 @@ export function mobileAuthRouter() { res.status(payload.statusCode).json(payload.json) }) + // Required since this will be called from Android WebView + router.options( + '/android-apple-redirect', + cors({ ...corsConfig, maxAge: 600 }) + ) + router.post('/android-apple-redirect', (req, res) => { const { id_token } = req.body return res.redirect(