Skip to content

Instantly share code, notes, and snippets.

@jackrobertscott
Last active August 13, 2021 23:32
Show Gist options
  • Save jackrobertscott/5a2c21ca93b6cf024653a9b2a867d2e7 to your computer and use it in GitHub Desktop.
Save jackrobertscott/5a2c21ca93b6cf024653a9b2a867d2e7 to your computer and use it in GitHub Desktop.
import axios from 'axios';
async function getGoogleUserInfo(access_token) {
const { data } = await axios({
url: 'https://www.googleapis.com/oauth2/v2/userinfo',
method: 'get',
headers: {
Authorization: `Bearer ${access_token}`,
},
});
console.log(data); // { id, email, given_name, family_name }
return data;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment