diff --git a/package.json b/package.json index 7abe3f3e78..19e368399a 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,5 @@ "electron-rebuild": "^1.6.0", "jest": "^22.1.1", "lerna": "^2.7.1" - }, - "dependencies": {} + } } diff --git a/packages/insomnia-app/app/network/authentication.js b/packages/insomnia-app/app/network/authentication.js index 5aa40310d1..ef8947c6ce 100644 --- a/packages/insomnia-app/app/network/authentication.js +++ b/packages/insomnia-app/app/network/authentication.js @@ -34,7 +34,15 @@ export async function getAuthHeader ( } if (authentication.type === AUTH_OAUTH_2) { - const oAuth2Token = await getOAuth2Token(requestId, authentication); + // HACK: GraphQL requests use a child request to fetch the schema with an + // ID of "{{request_id}}.graphql". Here we are removing the .graphql suffix and + // pretending we are fetching a token for the original request. This makes sure + // the same tokens are used for schema fetching. See issue #835 on GitHub. + const tokenId = requestId.match(/\.graphql$/) + ? requestId.replace(/\.graphql$/, '') + : requestId; + + const oAuth2Token = await getOAuth2Token(tokenId, authentication); if (oAuth2Token) { const token = oAuth2Token.accessToken; return _buildBearerHeader(token, authentication.tokenPrefix);