Skip to content

Instantly share code, notes, and snippets.

@magician11 magician11/google-oauth.js
Last active Nov 12, 2017

What would you like to do?
How to get a new Google access token from a refresh token on Node.js
const axios = require('axios');
const querystring = require('querystring');
const keys = require('../config/keys');
const getAccessToken = async refreshToken => {
try {
const accessTokenObj = await
refresh_token: refreshToken,
client_id: keys.googleClientID,
client_secret: keys.googleClientSecret,
grant_type: 'refresh_token'
} catch (err) {
passport.authenticate('google', {
scope: ['profile', 'email', ''],
accessType: 'offline',
prompt: 'consent'

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.