Github.getLoginUrl()

Get the URL on github.com that a user should visit to authorize the specified GitHub app (i.e. your app).

This is the URL where you typically redirect a user in order for them to grant access to your GitHub app.

Usage

Hover over inputs/exits for more info.

var Github = require('machinepack-github');


// Get the URL on github.com that a user should visit to authorize the specified GitHub app (i.e. your app).

Github.getLoginUrl({

clientId: 'abc123jdhs3h4js',

callbackUrl: 'http://my-cool-app.com/auth/callback',

scope: [ 'public_repo' ],

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

clientId required

The unique identifier for your GitHub app. It's listed on the application settings page.

'abc123jdhs3h4js'
callbackUrl required

The URL in your app where users will be sent after authorization.

'http://my-cool-app.com/auth/callback'
scope

A comma separated list of scopes requested for the authorization.

[ 'public_repo' ]

Exits

error

An unexpected error occurred.

success

OK.

'https://github.com/login/oauth/authorize?client_id=215798311808508&redirect_uri=http://localhost:1337/auth/authorize&scope=email,friends'