mirror of
https://github.com/graphql-hive/console
synced 2026-05-23 17:18:23 +00:00
fix: print debug info (#344)
* fix: print debug info * chore: add more context
This commit is contained in:
parent
5389f76347
commit
9df79794f9
1 changed files with 12 additions and 4 deletions
|
|
@ -275,7 +275,9 @@ async function doesUserExistInAuth0(config: LegacyAuth0ConfigEnabled, email: str
|
|||
);
|
||||
|
||||
if (response.status !== 200) {
|
||||
throw new Error('Could not check whether user exists in Auth0.');
|
||||
throw new Error(
|
||||
`Could not check whether user exists in Auth0. Status: ${response.status} Body: ${await response.text()}`
|
||||
);
|
||||
}
|
||||
|
||||
const body = await response.json();
|
||||
|
|
@ -313,7 +315,7 @@ async function trySignIntoAuth0WithUserCredentialsAndRetrieveUserInfo(
|
|||
const body = await response.text();
|
||||
|
||||
if (response.status !== 200) {
|
||||
throw new Error("Couldn't authenticate user with Auth0.");
|
||||
throw new Error(`Couldn't authenticate user with Auth0. Status: ${response.status} Body: ${await response.text()}`);
|
||||
}
|
||||
|
||||
const { access_token: accessToken } = JSON.parse(body);
|
||||
|
|
@ -369,7 +371,13 @@ const generateAuth0AccessToken = async (config: LegacyAuth0ConfigEnabled): Promi
|
|||
audience: config['AUTH_LEGACY_AUTH0_AUDIENCE'],
|
||||
grant_type: 'client_credentials',
|
||||
}),
|
||||
}).then(res => res.json());
|
||||
});
|
||||
|
||||
return response.access_token;
|
||||
const body = await response.text();
|
||||
|
||||
if (response.status !== 200) {
|
||||
throw new Error(`Couldn't generate access token for Auth0. Status: ${response.status} Body: ${body}`);
|
||||
}
|
||||
|
||||
return JSON.parse(body).access_token;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue