fave77/pbchess

OAuth refresh token expiring after 7 days

Opened this issue ยท 1 comments

Describe the bug ๐Ÿ›
After generating a refresh token, it is expiring after 7 days.
Due to this the sendMail function fails as the refresh token (and access token) wasn't valid then.

const oAuth2Client = new google.auth.OAuth2(googleClientID, googleClientSecret, redirectURL);
oAuth2Client.setCredentials({refresh_token: googleRefreshToken});
// Gets the access token at that moment
const accessToken = await oAuth2Client.getAccessToken();
// Transporter object specifying the type of email used
const transporter = nodemailer.createTransport({
host: 'smtp.gmail.com',
port: 465,
secure: true,
auth:{
type: 'OAuth2',
user: user,
clientId: googleClientID,
clientSecret: googleClientSecret,
refreshToken: googleRefreshToken,
accessToken: accessToken
}
});

To Reproduce ๐Ÿ”
Steps to reproduce the behavior:

It may take you to wait a week after creating a new refresh token

  1. Create a new google oauth refresh token
  2. Check after some days (general behaviour is after a week), the refresh token isn't valid, and calls requiring it fails too.

Expected behaviour ๐Ÿ
Access token are valid for short time, but the same is not true for refresh tokens, it should be able to send the mail.

Desktop (please complete the following information): ๐Ÿ’ป

  • Windows 10
  • Firefox
  • Version 88.0

Additional context ๐Ÿ“
Related question on SO: https://stackoverflow.com/questions/66307450/why-my-google-drive-refresh-token-is-expiring-after-7-days

please assign me this issue