Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

Code Block
languagejs
titleConfiguration sample
linenumberstrue
collapsetrue
"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.


Image Added



After the application is created, the overview page views the credentials that should be used in configuring the passport strategy as below 

Image Added

Image Added

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.