Introduction
Passport Github authentication strategy using OAuth 2.0
Configuration sample object
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
"github": {
clientID: '%client_ID%',
clientSecret: '%client_secret%',
callbackURL: '%client_callback%'
} |
Configuration Steps
1 - Create a Github application
You must register an app with Github in Developers Applications in Github's settings panel. Once an app is created, clientID and clientSecret that will be used in the strategy configuration in addition to a callback URL that is you define and matches a route in your application.
After the application is created, the overview page views the credentials that should be used in configuring the passport strategy as below
The GitHub authentication strategy authenticates users using a GitHub account and OAuth 2.0 tokens.
The GitHub authentication strategy authenticates users using a GitHub account and OAuth 2.0 tokens.The GitHub authentication strategy authenticates users using a GitHubcount and OAuth 2.0 token
3 - Strategy Configuration
The passport-github strategy authenticates users using a Github user account and OAuth 2.0 tokens. Client ID and Secret granted in the creation of an app should be added to the config file as options so the strategy will be created. The callback URL will be used to receive the access-token, refresh-token, and profile which is the Github authenticated user profile.