Skip to content

Instantly share code, notes, and snippets.

@jackrobertscott
Last active August 4, 2021 17:17
Show Gist options
  • Select an option

  • Save jackrobertscott/cb5f11cd7d77ee09ab74924b3ea0ef99 to your computer and use it in GitHub Desktop.

Select an option

Save jackrobertscott/cb5f11cd7d77ee09ab74924b3ea0ef99 to your computer and use it in GitHub Desktop.
import axios from 'axios';
async function getGitHubUserData(access_token) {
const { data } = await axios({
url: 'https://api.github.com/user',
method: 'get',
headers: {
Authorization: `token ${access_token}`,
},
});
console.log(data); // { id, email, name, login, avatar_url }
return data;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment