Solution for Why does my google OAuth2 refresh_token expire after a week?
is Given Below:
I am currently creating a simple website using JS. In my application, I am using nodemailer as a tool so that individuals can contact me. The contact form goes directly to my email once the user submits the form.
I am using https//mail.google.com API with oAuth2 authentication (using refresh_token and accessToken). When I first began using oAuth2, it began working right away. However, “invalid_grant” has appeared in my console after submitting the form on the condition that the refresh_token I use have been living for a week. The token does work for the first 7 days but then expires by saying it’s an “invalid_grant” and that the “token has been revoked”.
How might I resolve this problem? (I’ll reply to any additional problems you have about this question)