GoogleAPIsOAuth2v2.getLoginUrl()

Generating an authentication URL

Usage

Hover over inputs/exits for more info.

var GoogleAPIsOAuth2v2 = require('machinepack-googleapisoauth2v2');


// Generating an authentication URL

GoogleAPIsOAuth2v2.getLoginUrl({

clientId: '284875887706-4gku5u85022s3cbsde5rpvps88ekcfql.apps.googleusercontent.com',

clientSecret: 'SomeSuperSecretKey',

redirectUrl: 'http://localhost:1337/user/google/login',

scope: [ 'https://www.googleapis.com/auth/plus.me' ],

accessType: 'offline',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

clientId required

OAuth2 Client ID

'284875887706-4gku5u85022s3cbsde5rpvps88ekcfql.apps.googleusercontent.com'
clientSecret required

OAuth2 Client Secret key

'SomeSuperSecretKey'
redirectUrl required

The callback URL where the end user will be redirected after visiting the login URL returned by this machine

'http://localhost:1337/user/google/login'
scope

List of urls that you need to asks permissions for

[ 'https://www.googleapis.com/auth/plus.me' ]
accessType

'online' (default) or 'offline' (gets refresh_token)

'offline'

Exits

error

An unexpected error occurred.

success

OK.

'https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=123&redirect_uri=123'