diff --git a/server/rr/rr-job-export.js b/server/rr/rr-job-export.js index 8a657b25e..79f0a970f 100644 --- a/server/rr/rr-job-export.js +++ b/server/rr/rr-job-export.js @@ -172,8 +172,11 @@ async function RRSelectedCustomer({ socket, redisHelpers, selectedCustomerId, jo // --- GraphQL job fetch async function QueryJobData({ socket, jobid }) { const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {}); + const currentToken = + (socket?.data && socket.data.authToken) || (socket?.handshake?.auth && socket.handshake.auth.token); + const result = await client - .setHeaders({ Authorization: `Bearer ${socket.handshake?.auth?.token}` }) + .setHeaders({ Authorization: `Bearer ${currentToken}` }) .request(queries.QUERY_JOBS_FOR_CDK_EXPORT, { id: jobid }); return result.jobs_by_pk; }