Backend Discussion

google oauth2 – googleapis

We can use googleapis npm to implement google oauth2 functionality.
Main thing is to create new one by refresh token when access token is expired.
  1. Get authorization code from client.
  2. Get refresh token from authorization code.
  3. Add following code to generate access token automatically when it is expired
oauth2Client.on('tokens', (tokens) => {  if (tokens.refresh_token) {    // store the refresh_token in my database!    console.log(tokens.refresh_token);  }  console.log(tokens.access_token);});

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *