github-oauth-express
- A simple package to get the
access_token
of a Github account for a particular client. So that we can call Github's user specific APIs. - Follow these steps to create a Github App and get
client_id
,client_secret
.- Login Github.
- Click your profile icon ->
Settings
->Developer Settings
->OAuth Apps
->New OAuth App
. - Enter your app details and specifically
callback URL
.
- In your App's Github Login button the redirection link must be
`https://github.com/login/oauth/authorize?client_id=`;
Implementation
Here you can obtain authToken using both callback way as well as promise way.
Promise
const express = ;const app = ; const githubAPI = ; // YOUR EXPRESS APPLICATION ;
Callback
const express = ;const app = ; const githubAPI = ; // YOUR EXPRESS APPLICATION ;
Once Auth Token obtained you can call Githubs Developer APIs by just adding a header in each request as