1.0.2 • Published 2 years ago
github-oauth-ts v1.0.2
Typescript component
Usage
Import the module
import GithubOauthClient from 'github-oauth-ts'
Instantiate the OAuth Client
const client = new GithubOauthClient({
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
redirectUri: 'YOUR_REDIRECT_URI',
})
API
Get AccessToken
Note that you must have the authCode beforehand. You're gonna usually have this code by your front-end application
const accessToken = await client.getAccessToken(authCode)
Get User Info
const userInfo = await client.getUserInfo(accessToken)