Google OAuth2 Email Client: Do I need to specify the access token?

Viewed 25

I have an application that sends emails on behalf of users. The way I initialize the credentials is shown below. It works perfectly fine, but I'm wondering if there's a long-term concern of only relying on refresh tokens and never using the access token.

What's the preferred method of setting credentials for oAuth2Client?

    const oAuth2Client = new google.auth.OAuth2(
        process.env.CLIENT_ID,
        process.env.CLIENT_SECRET,
        process.env.URL
    );
    oAuth2Client.setCredentials({
        refresh_token: refresh_token, 
        id_token: id_token
    })
    const email = google.gmail({ version: 'v1', auth: oAuth2Client });
0 Answers
Related