-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google OAuth2 Refresh Access Token upon Expiry #69
Comments
https://github.com/hatchways/team-vampire/tree/feature-be-passport-refresh attempt at getting passport refresh to work after following the following the code implemented in the issue here: leaving this error message here so I can debug later:
|
hi @bonnieli, I tested the freebusy route after the accessToken expired, and I believe the Sever Console Output Below: Database connected successfully
Method: GET
Path: /api/avail/freebusy
Body: {}
---
retries left 2
Free Busy Query Error: { GaxiosError: invalid_request
at Gaxios.<anonymous> (/home/michael/Documents/webdev/projects/team-vampire/server/node_modules/gaxios/build/src/gaxios.js:73:27)
at Generator.next (<anonymous>)
at fulfilled (/home/michael/Documents/webdev/projects/team-vampire/server/node_modules/gaxios/build/src/gaxios.js:16:58)
at processTicksAndRejections (internal/process/task_queues.js:86:5)
response:
{ config:
{ method: 'POST',
url: 'https://oauth2.googleapis.com/token',
data:
'refresh_token=1%2F%2F04kfnNu37OKqyCgYIARAAGAQSNwF-L9IrpHkiXWMPX3NeXij0r9dDxkhYDs5-b0yuVL_Etjy2fPx0UAay3KQSaziPm2D54hdYBVE&client_id=&client_secret=cRH2vVlg-jcdto68q-Wr8Y9s&grant_type=refresh_token',
headers: [Object],
params: [Object: null prototype] {},
paramsSerializer: [Function: paramsSerializer],
body:
'refresh_token=1%2F%2F04kfnNu37OKqyCgYIARAAGAQSNwF-L9IrpHkiXWMPX3NeXij0r9dDxkhYDs5-b0yuVL_Etjy2fPx0UAay3KQSaziPm2D54hdYBVE&client_id=&client_secret=cRH2vVlg-jcdto68q-Wr8Y9s&grant_type=refresh_token',
validateStatus: [Function: validateStatus],
responseType: 'json' },
data:
{ error: 'invalid_request',
error_description: 'Could not determine client ID from request.' },
headers:
{ 'alt-svc':
'h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"',
'cache-control': 'no-cache, no-store, max-age=0, must-revalidate',
connection: 'close',
'content-encoding': 'gzip',
'content-type': 'application/json; charset=utf-8',
date: 'Tue, 15 Dec 2020 01:16:02 GMT',
expires: 'Mon, 01 Jan 1990 00:00:00 GMT',
pragma: 'no-cache',
server: 'scaffolding on HTTPServer2',
'transfer-encoding': 'chunked',
vary: 'Origin, X-Origin, Referer',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '0' },
status: 400,
statusText: 'Bad Request' },
config:
{ method: 'POST',
url: 'https://oauth2.googleapis.com/token',
data:
'refresh_token=1%2F%2F04kfnNu37OKqyCgYIARAAGAQSNwF-L9IrpHkiXWMPX3NeXij0r9dDxkhYDs5-b0yuVL_Etjy2fPx0UAay3KQSaziPm2D54hdYBVE&client_id=&client_secret=cRH2vVlg-jcdto68q-Wr8Y9s&grant_type=refresh_token',
headers:
{ 'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'google-api-nodejs-client/3.1.2',
Accept: 'application/json' },
params: [Object: null prototype] {},
paramsSerializer: [Function: paramsSerializer],
body:
'refresh_token=1%2F%2F04kfnNu37OKqyCgYIARAAGAQSNwF-L9IrpHkiXWMPX3NeXij0r9dDxkhYDs5-b0yuVL_Etjy2fPx0UAay3KQSaziPm2D54hdYBVE&client_id=&client_secret=cRH2vVlg-jcdto68q-Wr8Y9s&grant_type=refresh_token',
validateStatus: [Function: validateStatus],
responseType: 'json' },
code: '400' }
// Request Access token
refresh token 1//04kfnNu37OKqyCgYIARAAGAQSNwF-L9IrpHkiXWMPX3NeXij0r9dDxkhYDs5-b0yuVL_Etjy2fPx0UAay3KQSaziPm2D54hdYBVE
ya29.a0AfH6SMDqs0F7t8F0uTI70gyfYWLXg5jD1wjLZ3i7XuKWoggjhoBMHFhELRBAlBHi-Q-OTkXKkOhDL5qSWn7UNNYY8awMFm5DXnx430geYXUCfv1JNsTigtdWuyPuMhaFkTnv99rFZ7qc2b3YwjZwzvbKuITmuQCH8yTrICgZtrC2
{ availabilities: [],
meetingTypes:
[ 5fcfe483c0135217f0de85d8,
5fd024366245dc104f8e146e,
5fd2972bbfee120cff8608a2 ],
_id: 5fcfe447c0135217f0de85d7,
googleId: '104348754318193001966',
accessToken:
'ya29.a0AfH6SMDqs0F7t8F0uTI70gyfYWLXg5jD1wjLZ3i7XuKWoggjhoBMHFhELRBAlBHi-Q-OTkXKkOhDL5qSWn7UNNYY8awMFm5DXnx430geYXUCfv1JNsTigtdWuyPuMhaFkTnv99rFZ7qc2b3YwjZwzvbKuITmuQCH8yTrICgZtrC2',
refreshToken:
'1//04kfnNu37OKqyCgYIARAAGAQSNwF-L9IrpHkiXWMPX3NeXij0r9dDxkhYDs5-b0yuVL_Etjy2fPx0UAay3KQSaziPm2D54hdYBVE',
firstName: 'Michael',
lastName: 'S',
email: '[email protected]',
profilePicture:
'https://lh3.googleusercontent.com/a-/AOh14GjAmMF8c19hWYlzl5fdYAyn5VS0iKNv95ugXtl_Pw=s96-c',
createdAt: 2020-12-08T20:38:31.287Z,
updatedAt: 2020-12-08T20:38:31.287Z,
__v: 3 }
// Second Attempt which was Successful
retries left 1
[] |
https://www.npmjs.com/package/passport-oauth2-refresh
The text was updated successfully, but these errors were encountered: