diff --git a/packages/query/src/routes/rpc.js b/packages/query/src/routes/rpc.js index cb92453..152e3da 100644 --- a/packages/query/src/routes/rpc.js +++ b/packages/query/src/routes/rpc.js @@ -29,6 +29,9 @@ const SERVICE_POLICY = { } } +const PROD = process.env.ENV === 'PROD' +const COOKIE_JWT = PROD ? 'prodJWT' : 'stagingJWT' + const register = async (server, rpcPath, { seed, authMemberId, rpcEndpoint, projectId }) => { const queryService = await queryBuilder.build({ seed, authMemberId, rpcEndpoint }) @@ -40,7 +43,7 @@ const register = async (server, rpcPath, { seed, authMemberId, rpcEndpoint, proj const getJWT = (request) => { // Try to get JWT from headers or cookie const header = request.raw.headers.authorization - const cookie = request.cookies.stagingJWT + const cookie = request.cookies[COOKIE_JWT] if (!header && !cookie) { return } diff --git a/packages/task/src/routes/rpc.js b/packages/task/src/routes/rpc.js index 6da403c..892110a 100644 --- a/packages/task/src/routes/rpc.js +++ b/packages/task/src/routes/rpc.js @@ -44,6 +44,9 @@ const SERVICE_POLICY = { } } +const PROD = process.env.ENV === 'PROD' +const COOKIE_JWT = PROD ? 'prodJWT' : 'stagingJWT' + const register = async (server, rpcPath, tasksPath, { seed, serviceAccount, faucetAmount, infuraId, authMemberId, rpcEndpoint, projectId }) => { const taskService = await taskBuilder.build({ projectId, relativeUri: tasksPath }) @@ -56,7 +59,7 @@ const register = async (server, rpcPath, tasksPath, { seed, serviceAccount, fauc const getJWT = (request) => { // Try to get JWT from headers or cookie const header = request.raw.headers.authorization - const cookie = request.cookies.stagingJWT + const cookie = request.cookies[COOKIE_JWT] if (!header && !cookie) { return }