0

I am using google-api-nodejs-client to access google calendar apis. I save the access_token, refresh_token, expiry_date to my db.

When user checks for calendar events, I set credentials of my oAuth2Client with values stored in my db.

It works fine till access_token expires. After that, I get the following error:

Missing required parameter: refresh_token

My code is:

fn getData(date) {
    //set access_token adnd refresh_token to values taken from db
    oAuth2Client.setCredentials({
        access_token: 'val from db',
        refresh_token: 'val from db' 
    })
    calendar = google.calendar({
        version: 'v3', 
        auth: oAuth2Client
    });
}
Akhil S
  • 145
  • 14
  • Possible duplicate of [Refresh token of google api do not work properly in nodejs](https://stackoverflow.com/questions/37286529/refresh-token-of-google-api-do-not-work-properly-in-nodejs) – Mehdi Jul 19 '19 at 09:07
  • 1
    Have you tried to `console.log(access_token, refresh_token)` to see whether expected values are sent? – Mehdi Jul 19 '19 at 09:09
  • @Mendi refreshAccessToken method is being deprecated – Akhil S Jul 19 '19 at 09:55
  • thank you i was sending wrong refresh token – Akhil S Jul 19 '19 at 10:04

0 Answers0