fragordie
04/28/2022, 9:00 AMRequest failed with status code 400
Error: Request failed with status code 400
at createError (D:\git\evt-server\node_modules\supertokens-node\node_modules\axios\lib\core\createError.js:16:15)
at settle (D:\git\evt-server\node_modules\supertokens-node\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (D:\git\evt-server\node_modules\supertokens-node\node_modules\axios\lib\adapters\http.js:269:11)
at IncomingMessage.emit (node:events:406:35)
at endReadableNT (node:internal/streams/readable:1331:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
nkshah2
04/28/2022, 9:06 AMRequest failed with status code 400
Error: Request failed with status code 400
at createError (D:\git\evt-server\node_modules\supertokens-node\node_modules\axios\lib\core\createError.js:16:15)
at settle (D:\git\evt-server\node_modules\supertokens-node\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (D:\git\evt-server\node_modules\supertokens-node\node_modules\axios\lib\adapters\http.js:269:11)
at IncomingMessage.emit (node:events:406:35)
at endReadableNT (node:internal/streams/readable:1331:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
nkshah2
04/28/2022, 9:06 AMfragordie
04/28/2022, 9:08 AMfragordie
04/28/2022, 9:09 AMfragordie
04/28/2022, 9:10 AMnkshah2
04/28/2022, 9:20 AMfragordie
04/28/2022, 9:26 AMnkshah2
04/28/2022, 9:28 AMfragordie
04/28/2022, 9:28 AMnkshah2
04/28/2022, 9:38 AMcode
?fragordie
04/28/2022, 9:39 AMfragordie
04/28/2022, 9:44 AMhttps://evt-api-dev.revod.cloud/redirect?code=4%2Factualcodehere&scope=email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+openid&authuser=0&prompt=consent
4. I execute the POST request showed above, inserting the code I received from the callback and replacing %2F with /.fragordie
04/28/2022, 9:45 AMfragordie
04/28/2022, 9:45 AMfragordie
04/28/2022, 9:48 AMnkshah2
04/28/2022, 9:48 AMnkshah2
04/28/2022, 9:49 AMfragordie
04/28/2022, 9:49 AMfragordie
04/28/2022, 9:49 AMnkshah2
04/28/2022, 9:53 AMnkshah2
04/28/2022, 9:53 AMfragordie
04/28/2022, 9:56 AMfragordie
04/28/2022, 9:56 AMnkshah2
04/28/2022, 10:00 AMfragordie
04/28/2022, 10:01 AMfragordie
04/28/2022, 10:01 AM{
"url": "https://accounts.google.com/o/oauth2/token",
"method": "post",
"data": "client_id=123953051473-g1186h1b6vgg7p2okdactap1v1dq1d00.apps.googleusercontent.com&client_secret=GOCSPX-yarSGNbRN6wfeewfwq8&grant_type=authorization_code&code=4%2F0AX4XfWgkPdHTlOArVBYLrq2DLB9fHl54bou4MgDZhZVzsxFgtLUKKQxnxfAZvnhOBlNMiQ&redirect_uri=https%3A%2F%2Fevt-client-planner-dev.revod.cloud%2Fredirect",
"headers": {
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "axios/0.21.4",
"Content-Length": 316
},
"transformRequest": [
null
],
"transformResponse": [
null
],
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"maxBodyLength": -1,
"transitional": {
"silentJSONParsing": true,
"forcedJSONParsing": true,
"clarifyTimeoutError": false
}
}
fragordie
04/28/2022, 10:02 AMfragordie
04/28/2022, 10:13 AMnkshah2
04/28/2022, 10:13 AMfragordie
04/28/2022, 10:13 AMfragordie
04/28/2022, 10:17 AMnkshah2
04/28/2022, 10:17 AMfragordie
04/28/2022, 10:18 AMfragordie
04/28/2022, 10:18 AMnkshah2
04/28/2022, 10:18 AMnkshah2
04/28/2022, 10:18 AMfragordie
04/28/2022, 10:18 AMfragordie
04/28/2022, 10:18 AMfragordie
04/28/2022, 10:19 AMts
authorisationUrlGET: async function (input: {
provider: TypeProvider;
options: ThirdPartyAPIOptions;
userContext: any;
}): Promise<{
status: 'OK';
url: string;
}> {
const response =
await originalImplementation.authorisationUrlGET(input);
if (input.provider.id != 'google') return response;
if (response.status != 'OK') return response;
const urlWithRedirect = new URL(response.url);
urlWithRedirect.searchParams.delete('redirect_uri');
if (input.options.req.original.query.redirect_uri) {
urlWithRedirect.searchParams.append(
'redirect_uri',
input.options.req.original.query.redirect_uri,
);
}
return {
status: 'OK',
url: urlWithRedirect.toString(),
};
},
fragordie
04/28/2022, 10:19 AMfragordie
04/28/2022, 10:19 AMfragordie
04/28/2022, 10:20 AMnkshah2
04/28/2022, 10:26 AMfragordie
04/28/2022, 10:47 AMfragordie
04/28/2022, 10:47 AMnkshah2
04/28/2022, 10:47 AMfragordie
04/28/2022, 10:47 AMfragordie
04/28/2022, 10:47 AMnkshah2
04/28/2022, 10:48 AMfragordie
04/28/2022, 10:50 AMts
recipeList: [
ThirdPartyPasswordless.init({
flowType: 'MAGIC_LINK',
contactMethod: 'EMAIL',
providers: [
ThirdPartyPasswordless.Google({
clientId: this.envConfig.get<string>('OAUTH_GOOGLE_CLIENT_ID'),
clientSecret: this.envConfig.get<string>(
'OAUTH_GOOGLE_CLIENT_SECRET',
),
}),
],
override: {
apis: (originalImplementation) => {
return {
...originalImplementation,
authorisationUrlGET: async function (input: {
provider: TypeProvider;
options: ThirdPartyAPIOptions;
userContext: any;
}): Promise<{
status: 'OK';
url: string;
}> {
const response =
await originalImplementation.authorisationUrlGET(input);
if (input.provider.id != 'google') return response;
if (response.status != 'OK') return response;
const urlWithRedirect = new URL(response.url);
urlWithRedirect.searchParams.delete('redirect_uri');
if (input.options.req.original.query.redirect_uri) {
urlWithRedirect.searchParams.append(
'redirect_uri',
input.options.req.original.query.redirect_uri,
);
urlWithRedirect.searchParams.delete('access_type');
urlWithRedirect.searchParams.append(
'access_type',
'online',
); // line that fixed
}
return {
status: 'OK',
url: urlWithRedirect.toString(),
};
},
};
},
fragordie
04/28/2022, 10:51 AMnkshah2
04/28/2022, 10:51 AMnkshah2
04/28/2022, 10:51 AMnkshah2
04/28/2022, 11:02 AMhttp://evt-api-dev.revod.cloud/redirect
nkshah2
04/28/2022, 11:02 AMhttps://evt-client-planner-dev.revod.cloud/redirect
nkshah2
04/28/2022, 11:02 AMnkshah2
04/28/2022, 11:03 AMnkshah2
04/28/2022, 11:03 AMfragordie
04/28/2022, 11:04 AMfragordie
04/28/2022, 11:04 AMnkshah2
04/28/2022, 11:04 AMfragordie
04/28/2022, 11:07 AMfragordie
04/28/2022, 11:07 AMfragordie
04/28/2022, 11:07 AMnkshah2
04/28/2022, 11:07 AMfragordie
04/28/2022, 11:08 AMnkshah2
04/28/2022, 11:08 AMfragordie
04/28/2022, 11:09 AM