Github Strategy

Introduction

Passport Github authentication strategy using OAuth 2.0


Configuration sample object

Below is a configuration sample that is needed for the Github strategy to be configured. Follow the steps below the sample to get those configurations.

Configuration sample
"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 

2 - 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 the Github authenticated user profile.