Skip to content

Instantly share code, notes, and snippets.

@creuserr
Last active May 25, 2024 05:53
Show Gist options
  • Save creuserr/976efab18a0b16c87e1279b92e8ede5f to your computer and use it in GitHub Desktop.
Save creuserr/976efab18a0b16c87e1279b92e8ede5f to your computer and use it in GitHub Desktop.
check if a github user follows a specific user by its personal access token
async function isFollowing(token, username) {
const req = await fetch(`https://api.github.com/user/following/${username}`, {
headers: {
authorization: `Bearer ${token}`
}
});
return req.status == 204;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment