Comparing version 3.3.3 to 3.4.0
## Change Log | ||
### v3.4.0 (2015/07/20) | ||
- `Changed` better configuration initialization | ||
- `Added` docs about the [programmatic access](https://github.com/simov/grant#programmatic-access) | ||
- `Added` docs about how to utilize [sandbox urls](https://github.com/simov/grant#custom-parameters) | ||
- `Added` official support for 3 more providers | ||
- `Changed` bumped module dependency versions | ||
- `Changed` migrated *rdio* to [OAuth2](https://github.com/simov/grant/blob/master/config/oauth.json#L420-L424) | ||
- `Changed` updated the *trakt* [urls](https://github.com/simov/grant/blob/master/config/oauth.json#L543-L544) | ||
- `Added` [custom_parameters](https://github.com/simov/grant/blob/master/config/oauth.json#L655) for *yandex* | ||
### v3.3.3 (2015/06/24) | ||
@@ -5,0 +15,0 @@ - `Added` official support for 9 more providers |
@@ -223,2 +223,7 @@ { | ||
}, | ||
"familysearch": { | ||
"authorize_url": "https://ident.familysearch.org/cis-web/oauth2/v3/authorization", | ||
"access_url": "https://ident.familysearch.org/cis-web/oauth2/v3/token", | ||
"oauth": 2 | ||
}, | ||
"feedly": { | ||
@@ -333,2 +338,7 @@ "authorize_url": "https://cloud.feedly.com/v3/auth/auth", | ||
}, | ||
"kakao": { | ||
"authorize_url": "https://kauth.kakao.com/oauth/authorize", | ||
"access_url": "https://kauth.kakao.com/oauth/token", | ||
"oauth": 2 | ||
}, | ||
"linkedin": { | ||
@@ -413,6 +423,5 @@ "request_url": "https://api.linkedin.com/uas/oauth/requestToken", | ||
"rdio": { | ||
"request_url": "http://api.rdio.com/oauth/request_token", | ||
"authorize_url": "https://www.rdio.com/oauth/authorize", | ||
"access_url": "http://api.rdio.com/oauth/access_token", | ||
"oauth": 1 | ||
"authorize_url": "https://www.rdio.com/oauth2/authorize", | ||
"access_url": "https://services.rdio.com/oauth2/token", | ||
"oauth": 2 | ||
}, | ||
@@ -519,2 +528,8 @@ "redbooth": { | ||
}, | ||
"surveygizmo": { | ||
"request_url": "http://restapi.surveygizmo.com/head/oauth/request_token", | ||
"authorize_url": "http://restapi.surveygizmo.com/head/oauth/authenticate", | ||
"access_url": "http://restapi.surveygizmo.com/head/oauth/access_token", | ||
"oauth": 1 | ||
}, | ||
"surveymonkey": { | ||
@@ -532,4 +547,4 @@ "authorize_url": "https://api.surveymonkey.com/oauth/authorize", | ||
"trakt": { | ||
"authorize_url": "https://api.trakt.tv/oauth/authorize", | ||
"access_url": "https://api.trakt.tv/oauth/token", | ||
"authorize_url": "https://api-v2launch.trakt.tv/oauth/authorize", | ||
"access_url": "https://api-v2launch.trakt.tv/oauth/token", | ||
"oauth": 2 | ||
@@ -642,5 +657,6 @@ }, | ||
"yandex": { | ||
"authorize_url": "https://oauth.yandex.ru/authorize", | ||
"access_url": "https://oauth.yandex.ru/token", | ||
"oauth": 2 | ||
"authorize_url": "https://oauth.yandex.com/authorize", | ||
"access_url": "https://oauth.yandex.com/token", | ||
"oauth": 2, | ||
"custom_parameters": ["device_id", "device_name"] | ||
}, | ||
@@ -647,0 +663,0 @@ "zendesk": { |
@@ -5,3 +5,27 @@ 'use strict' | ||
// oauth configuration | ||
exports.oauth = require('../config/oauth.json') | ||
// reserved keys | ||
exports.reserved = require('../config/reserved.json') | ||
// oauth credentials transform | ||
exports.credentials = function (provider, options) { | ||
var key, secret | ||
if (provider.oauth == 1) { | ||
key = options.consumer_key || provider.key | ||
secret = options.consumer_secret || provider.secret | ||
} | ||
else if (provider.oauth == 2) { | ||
key = options.client_id || provider.key | ||
secret = options.client_secret || provider.secret | ||
} | ||
if (key) { | ||
provider.key = key | ||
} | ||
if (secret) { | ||
provider.secret = secret | ||
} | ||
} | ||
// oauth scope transform | ||
@@ -21,19 +45,15 @@ exports.scope = function (provider, options) { | ||
// oauth credentials transform | ||
exports.credentials = function (provider, options) { | ||
if (provider.oauth == 1) { | ||
provider.key = options.consumer_key || provider.key | ||
provider.secret = options.consumer_secret || provider.secret | ||
// oauth state transform | ||
exports.state = function (provider) { | ||
var state | ||
if (typeof provider.state == 'string' || typeof provider.state == 'number') { | ||
state = provider.state.toString() | ||
} | ||
else if (provider.oauth == 2) { | ||
provider.key = options.client_id || provider.key | ||
provider.secret = options.client_secret || provider.secret | ||
else if (typeof provider.state == 'boolean' && provider.state) { | ||
state = (Math.floor(Math.random() * 999999) + 1).toString() | ||
} | ||
return state | ||
} | ||
exports.transform = function (provider, options) { | ||
this.scope(provider, options) | ||
this.credentials(provider, options) | ||
} | ||
// override provider | ||
exports.override = function (provider, options) { | ||
@@ -45,7 +65,2 @@ var override = dcopy(provider) | ||
} | ||
return override | ||
} | ||
exports.dynamic = function (provider, options) { | ||
var override = this.override(provider, options) | ||
this.transform(override, options) | ||
@@ -55,79 +70,79 @@ return override | ||
exports.state = function (provider) { | ||
var state | ||
if (typeof provider.state == 'string' || typeof provider.state == 'number') { | ||
state = provider.state.toString() | ||
} | ||
else if (typeof provider.state == 'boolean' && provider.state) { | ||
state = (Math.floor(Math.random() * 999999) + 1).toString() | ||
} | ||
return state | ||
// apply multiple transformations | ||
exports.transform = function (provider, options) { | ||
this.credentials(provider, options) | ||
this.scope(provider, options) | ||
} | ||
exports.init = function (config) { | ||
config = config||{} | ||
// oauth configuration | ||
var oauth = require('../config/oauth.json') | ||
// reserved keys | ||
var reserved = require('../config/reserved.json') | ||
// generated below | ||
var result = {} | ||
// generate provider options | ||
exports.initProvider = function (key, config) { | ||
// oauth provider settings | ||
var provider = dcopy(this.oauth[key]||{}) | ||
// oauth application options | ||
var options = config[key]||{} | ||
// custom providers | ||
var providers = Object.keys(oauth) | ||
Object.keys(config) | ||
.filter(function (key) { | ||
return providers.indexOf(key) == -1 | ||
}) | ||
.forEach(function (key) { | ||
oauth[key] = config[key] | ||
}) | ||
// provider shortcuts | ||
provider[key] = true | ||
provider.name = key | ||
// generate provider options | ||
for (var key in oauth) { | ||
// oauth provider settings | ||
var provider = dcopy(oauth[key]) | ||
// oauth application options | ||
var options = config[key]||{} | ||
// set reserved keys | ||
this.reserved.forEach(function (key) { | ||
var value = options[key] || config.server[key] || provider[key] | ||
if (value) { | ||
provider[key] = value | ||
} | ||
}) | ||
// provider shortcuts | ||
provider[key] = true | ||
provider.name = key | ||
// custom parameters | ||
if (provider.custom_parameters) { | ||
for (var key in options) { | ||
if (typeof options[key] === 'string' && | ||
this.reserved.indexOf(key) == -1 && | ||
provider.custom_parameters.indexOf(key) != -1) { | ||
// | ||
reserved.forEach(function (key) { | ||
provider[key] = options[key] || config.server[key] || provider[key] | ||
}) | ||
// custom | ||
for (var key in options) { | ||
if ( | ||
typeof options[key] === 'string' && reserved.indexOf(key) == -1 && | ||
provider.custom_parameters && provider.custom_parameters.indexOf(key) != -1 | ||
) { | ||
provider[key] = options[key] | ||
} | ||
} | ||
} | ||
// overrides | ||
var overrides = {} | ||
for (var key in options) { | ||
if ( | ||
reserved.indexOf(key) == -1 && | ||
key != 'scope' && typeof options[key] === 'object' | ||
) { | ||
overrides[key] = this.dynamic(provider, options[key]) | ||
} | ||
// static overrides | ||
var overrides = {} | ||
for (var key in options) { | ||
if (this.reserved.indexOf(key) == -1 && | ||
key != 'scope' && | ||
typeof options[key] === 'object') { | ||
overrides[key] = this.override(provider, options[key]) | ||
} | ||
this.transform(provider, options) | ||
} | ||
if (Object.keys(overrides).length) { | ||
provider.overrides = overrides | ||
} | ||
this.transform(provider, options) | ||
return provider | ||
} | ||
// initialize all configured providers | ||
exports.init = function (config) { | ||
config = config||{} | ||
var result = {} | ||
// generate provider options | ||
for (var key in config) { | ||
var provider = this.initProvider(key, config) | ||
result[provider.name] = provider | ||
} | ||
result.server = config.server||{} | ||
return result | ||
} | ||
// get provider on connect | ||
exports.provider = function (config, session) { | ||
var provider = config[session.provider] | ||
if (!provider) { | ||
provider = this.initProvider(session.provider, config) | ||
config[provider.name] = provider | ||
} | ||
if (session.override && provider.overrides) { | ||
@@ -138,3 +153,3 @@ var override = provider.overrides[session.override] | ||
if (session.dynamic) { | ||
provider = this.dynamic(provider, session.dynamic) | ||
provider = this.override(provider, session.dynamic) | ||
} | ||
@@ -141,0 +156,0 @@ if (provider.state) { |
@@ -18,2 +18,3 @@ 'use strict' | ||
app.config = config.init(_config) | ||
app._config = config | ||
@@ -20,0 +21,0 @@ app.all('/connect/:provider/:override?', function (req, res, next) { |
@@ -23,2 +23,3 @@ 'use strict' | ||
this.register.config = self.config | ||
this.register._config = config | ||
@@ -25,0 +26,0 @@ server.route({ |
@@ -25,2 +25,3 @@ 'use strict' | ||
app.config = config.init(_config) | ||
app._config = config | ||
@@ -27,0 +28,0 @@ app.use(route.all('/connect/:provider/:override?', function *(provider, override, next) { |
{ | ||
"name": "grant", | ||
"version": "3.3.3", | ||
"version": "3.4.0", | ||
"description": "OAuth Middleware for Express, Koa and Hapi", | ||
@@ -27,4 +27,4 @@ | ||
"dependencies": { | ||
"request" : "2.53.0", | ||
"qs" : "2.4.1", | ||
"request" : "2.59.0", | ||
"qs" : "4.0.0", | ||
"deep-copy" : "*" | ||
@@ -71,3 +71,3 @@ }, | ||
"test" : "npm run lint-lib && npm run lint-test && npm run test-ci", | ||
"test-ci" : "v=$(node --version | cut -b 4-5) && if [ $v -ge 12 ]; then mocha --harmony --recursive test/; else mocha test/ test/flow/ test/consumer/express/ test/consumer/hapi/; fi", | ||
"test-ci" : "major=$(node --version | cut -b 2-2) && minor=$(node --version | cut -b 4-5) && if [ $major -eq 0 ] && [ $minor -ge 12 ]; then mocha --harmony --recursive test/; elif [ $major -ge 1 ]; then mocha --recursive test/; else mocha test/ test/flow/ test/consumer/express/ test/consumer/hapi/; fi", | ||
"test-cov" : "istanbul cover _mocha test/ test/flow/ test/consumer/express/ test/consumer/hapi/", | ||
@@ -74,0 +74,0 @@ "lint-lib" : "eslint lib/ && echo Lint lib passed", |
@@ -9,3 +9,3 @@ | ||
[`23andme`](https://api.23andme.com) | [`500px`](http://developers.500px.com) | [`acton`](https://developer.act-on.com) | [`amazon`](http://login.amazon.com/documentation) | [`angellist`](https://angel.co/api) | [`appnet`](https://developers.app.net) | [`asana`](https://asana.com/developers) | [`assembla`](http://api-doc.assembla.com) | [`basecamp`](https://github.com/basecamp/bcx-api) | [`beatport`](https://oauth-api.beatport.com) | [`beatsmusic`](https://developer.beatsmusic.com) | [`bitbucket`](https://confluence.atlassian.com/display/BITBUCKET) | [`bitly`](http://dev.bitly.com) | [`box`](https://developers.box.com) | [`buffer`](https://dev.buffer.com) | [`campaignmonitor`](https://www.campaignmonitor.com/api) | [`cheddar`](https://cheddarapp.com/developer) | [`coinbase`](https://developers.coinbase.com) | [`constantcontact`](https://developer.constantcontact.com) | [`copy`](https://developers.copy.com) | [`coursera`](https://tech.coursera.org) | [`dailymile`](http://www.dailymile.com/api/documentation) | [`dailymotion`](https://developer.dailymotion.com) | [`deezer`](http://developers.deezer.com) | [`delivery`](https://developers.delivery.com) | [`deviantart`](https://www.deviantart.com/developers/) | [`digitalocean`](https://developers.digitalocean.com) | [`discogs`](http://www.discogs.com/developers) | [`disqus`](https://disqus.com/api/docs) | [`dribbble`](http://developer.dribbble.com) | [`dropbox`](https://www.dropbox.com/developers) | [`echosign`](https://secure.echosign.com/public/docs/restapi/v3) | [`edmodo`](https://developers.edmodo.com) | [`elance`](https://www.elance.com/q/api2) | [`etsy`](https://www.etsy.com/developers) | [`eventbrite`](http://developer.eventbrite.com) | [`evernote`](https://dev.evernote.com) | [`everyplay`](https://developers.everyplay.com) | [`eyeem`](https://www.eyeem.com/developers) | [`facebook`](https://developers.facebook.com) | [`feedly`](https://developer.feedly.com) | [`fitbit`](http://dev.fitbit.com) | [`flattr`](http://developers.flattr.net) | [`flickr`](https://www.flickr.com/services) | [`flowdock`](https://www.flowdock.com/api) | [`foursquare`](https://developer.foursquare.com) | [`freshbooks`](https://www.freshbooks.com/developers) | [`geeklist`](http://hackers.geekli.st) | [`getpocket`](http://getpocket.com/developer) | [`github`](https://developer.github.com) | [`gitlab`](http://doc.gitlab.com/ce/api) | [`gitter`](https://developer.gitter.im) | [`goodreads`](https://www.goodreads.com/api) | [`google`](https://developers.google.com) | [`harvest`](https://github.com/harvesthq/api) | [`heroku`](https://devcenter.heroku.com/categories/platform-api) | [`imgur`](https://api.imgur.com) | [`instagram`](https://instagram.com/developer) | [`jawbone`](https://jawbone.com/up/developer) | [`linkedin`](https://developer.linkedin.com) | [`live`](https://msdn.microsoft.com/en-us/library/dn783283.aspx) | [`mailchimp`](https://apidocs.mailchimp.com) | [`mapmyfitness`](https://developer.underarmour.com) | [`meetup`](http://www.meetup.com/meetup_api) | [`mixcloud`](https://www.mixcloud.com/developers) | [`moves`](https://dev.moves-app.com) | [`myob`](http://developer.myob.com) | [`odesk`](https://developers.odesk.com) | [`openstreetmap`](http://wiki.openstreetmap.org/wiki/API_v0.6) | [`paypal`](https://developer.paypal.com) | [`plurk`](http://www.plurk.com/API) | [`podio`](https://developers.podio.com) | [`rdio`](http://www.rdio.com/developers) | [`redbooth`](https://redbooth.com/api) | [`reddit`](http://www.reddit.com/dev/api) | [`runkeeper`](http://developer.runkeeper.com) | [`salesforce`](https://developer.salesforce.com) | [`shoeboxed`](https://github.com/Shoeboxed/api) | [`shopify`](https://docs.shopify.com/api) | [`skyrock`](http://www.skyrock.com/developer) | [`slack`](https://api.slack.com) | [`slice`](https://developer.slice.com) | [`socrata`](http://dev.socrata.com) | [`soundcloud`](https://developers.soundcloud.com) | [`spotify`](https://developer.spotify.com) | [`square`](https://connect.squareup.com) | [`stackexchange`](https://api.stackexchange.com) | [`stocktwits`](http://stocktwits.com/developers) | [`stormz`](http://developer.stormz.me) | [`strava`](http://strava.github.io/api) | [`stripe`](https://stripe.com/docs) | [`surveymonkey`](https://developer.surveymonkey.com) | [`thingiverse`](http://www.thingiverse.com/developers) | [`trakt`](http://docs.trakt.apiary.io) | [`traxo`](https://developer.traxo.com) | [`trello`](https://trello.com/docs) | [`tripit`](https://www.tripit.com/developer) | [`tumblr`](https://www.tumblr.com/docs/en/api/v2) | [`twitch`](http://dev.twitch.tv) | [`twitter`](https://dev.twitter.com) | [`uber`](https://developer.uber.com) | [`underarmour`](https://developer.underarmour.com) | [`upwork`](https://developers.upwork.com) | [`uservoice`](https://developer.uservoice.com) | [`vend`](https://developers.vendhq.com) | [`vimeo`](https://developer.vimeo.com) | [`vk`](http://vk.com/dev) | [`withings`](http://oauth.withings.com/api) | [`wordpress`](https://developer.wordpress.com) | [`xing`](https://dev.xing.com) | [`yahoo`](https://developer.yahoo.com) | [`yammer`](https://developer.yammer.com) | [`yandex`](https://tech.yandex.com) | [`zendesk`](https://developer.zendesk.com) | ||
[`23andme`](https://api.23andme.com) | [`500px`](http://developers.500px.com) | [`acton`](https://developer.act-on.com) | [`amazon`](http://login.amazon.com/documentation) | [`angellist`](https://angel.co/api) | [`appnet`](https://developers.app.net) | [`asana`](https://asana.com/developers) | [`assembla`](http://api-doc.assembla.com) | [`basecamp`](https://github.com/basecamp/bcx-api) | [`beatport`](https://oauth-api.beatport.com) | [`beatsmusic`](https://developer.beatsmusic.com) | [`bitbucket`](https://confluence.atlassian.com/display/BITBUCKET) | [`bitly`](http://dev.bitly.com) | [`box`](https://developers.box.com) | [`buffer`](https://dev.buffer.com) | [`campaignmonitor`](https://www.campaignmonitor.com/api) | [`cheddar`](https://cheddarapp.com/developer) | [`coinbase`](https://developers.coinbase.com) | [`constantcontact`](https://developer.constantcontact.com) | [`copy`](https://developers.copy.com) | [`coursera`](https://tech.coursera.org) | [`dailymile`](http://www.dailymile.com/api/documentation) | [`dailymotion`](https://developer.dailymotion.com) | [`deezer`](http://developers.deezer.com) | [`delivery`](https://developers.delivery.com) | [`deviantart`](https://www.deviantart.com/developers/) | [`digitalocean`](https://developers.digitalocean.com) | [`discogs`](http://www.discogs.com/developers) | [`disqus`](https://disqus.com/api/docs) | [`dribbble`](http://developer.dribbble.com) | [`dropbox`](https://www.dropbox.com/developers) | [`echosign`](https://secure.echosign.com/public/docs/restapi/v3) | [`edmodo`](https://developers.edmodo.com) | [`elance`](https://www.elance.com/q/api2) | [`etsy`](https://www.etsy.com/developers) | [`eventbrite`](http://developer.eventbrite.com) | [`evernote`](https://dev.evernote.com) | [`everyplay`](https://developers.everyplay.com) | [`eyeem`](https://www.eyeem.com/developers) | [`facebook`](https://developers.facebook.com) | [`familysearch`](https://familysearch.org/developers) | [`feedly`](https://developer.feedly.com) | [`fitbit`](http://dev.fitbit.com) | [`flattr`](http://developers.flattr.net) | [`flickr`](https://www.flickr.com/services) | [`flowdock`](https://www.flowdock.com/api) | [`foursquare`](https://developer.foursquare.com) | [`freshbooks`](https://www.freshbooks.com/developers) | [`geeklist`](http://hackers.geekli.st) | [`getpocket`](http://getpocket.com/developer) | [`github`](https://developer.github.com) | [`gitlab`](http://doc.gitlab.com/ce/api) | [`gitter`](https://developer.gitter.im) | [`goodreads`](https://www.goodreads.com/api) | [`google`](https://developers.google.com) | [`harvest`](https://github.com/harvesthq/api) | [`heroku`](https://devcenter.heroku.com/categories/platform-api) | [`imgur`](https://api.imgur.com) | [`instagram`](https://instagram.com/developer) | [`jawbone`](https://jawbone.com/up/developer) | [`kakao`](https://developers.kakao.com) | [`linkedin`](https://developer.linkedin.com) | [`live`](https://msdn.microsoft.com/en-us/library/dn783283.aspx) | [`mailchimp`](https://apidocs.mailchimp.com) | [`mapmyfitness`](https://developer.underarmour.com) | [`meetup`](http://www.meetup.com/meetup_api) | [`mixcloud`](https://www.mixcloud.com/developers) | [`moves`](https://dev.moves-app.com) | [`myob`](http://developer.myob.com) | [`odesk`](https://developers.odesk.com) | [`openstreetmap`](http://wiki.openstreetmap.org/wiki/API_v0.6) | [`paypal`](https://developer.paypal.com) | [`plurk`](http://www.plurk.com/API) | [`podio`](https://developers.podio.com) | [`rdio`](http://www.rdio.com/developers) | [`redbooth`](https://redbooth.com/api) | [`reddit`](http://www.reddit.com/dev/api) | [`runkeeper`](http://developer.runkeeper.com) | [`salesforce`](https://developer.salesforce.com) | [`shoeboxed`](https://github.com/Shoeboxed/api) | [`shopify`](https://docs.shopify.com/api) | [`skyrock`](http://www.skyrock.com/developer) | [`slack`](https://api.slack.com) | [`slice`](https://developer.slice.com) | [`socrata`](http://dev.socrata.com) | [`soundcloud`](https://developers.soundcloud.com) | [`spotify`](https://developer.spotify.com) | [`square`](https://connect.squareup.com) | [`stackexchange`](https://api.stackexchange.com) | [`stocktwits`](http://stocktwits.com/developers) | [`stormz`](http://developer.stormz.me) | [`strava`](http://strava.github.io/api) | [`stripe`](https://stripe.com/docs) | [`surveygizmo`](http://apihelp.surveygizmo.com) | [`surveymonkey`](https://developer.surveymonkey.com) | [`thingiverse`](http://www.thingiverse.com/developers) | [`trakt`](http://docs.trakt.apiary.io) | [`traxo`](https://developer.traxo.com) | [`trello`](https://trello.com/docs) | [`tripit`](https://www.tripit.com/developer) | [`tumblr`](https://www.tumblr.com/docs/en/api/v2) | [`twitch`](http://dev.twitch.tv) | [`twitter`](https://dev.twitter.com) | [`uber`](https://developer.uber.com) | [`underarmour`](https://developer.underarmour.com) | [`upwork`](https://developers.upwork.com) | [`uservoice`](https://developer.uservoice.com) | [`vend`](https://developers.vendhq.com) | [`vimeo`](https://developer.vimeo.com) | [`vk`](http://vk.com/dev) | [`withings`](http://oauth.withings.com/api) | [`wordpress`](https://developer.wordpress.com) | [`xing`](https://dev.xing.com) | [`yahoo`](https://developer.yahoo.com) | [`yammer`](https://developer.yammer.com) | [`yandex`](https://tech.yandex.com) | [`zendesk`](https://developer.zendesk.com) | ||
@@ -29,2 +29,3 @@ | ||
- [Development Environments][development-environments] | ||
- [Programmatic Access][programmatic-access] | ||
- [Response Data][response-data] | ||
@@ -197,3 +198,3 @@ - Misc | ||
_(the custom key names cannot be one of the [reserved ones][reserved-keys])_ | ||
_(the custom key names cannot be one of the [reserved keys][reserved-keys])_ | ||
@@ -233,3 +234,2 @@ | ||
var state = (Math.floor(Math.random() * 999999) + 1) | ||
res.redirect('/connect/facebook?state=' + state) | ||
@@ -244,4 +244,6 @@ }) | ||
- For Freshbooks, Shopify, Socrata, Vend and Zendesk you should specify your company's sub domain name through the `subdomain` option | ||
- Some providers require you to set your company name as a subdomain in the authorization urls. For example for Freshbooks, Shopify, Vend and Zendesk you can set that value through the `subdomain` option (alternatively you can override the entire `request_url`, `authorize_url` and `access_url` in your configuration) | ||
- Some providers may have a _sandbox_ urls for testing. To use them just override the entire `request_url`, `authorize_url` and `access_url` in your configuration | ||
- For SurveyMonkey set your Mashery user name as `key` and your application key as `api_key` | ||
@@ -323,2 +325,19 @@ | ||
## Programmatic Access | ||
Once you initialize a new instance of Grant | ||
```js | ||
var grant = new Grant(require('./config')) | ||
``` | ||
You get a special `config` _(`register.config` for Hapi)_ property attached to that instance. It contains the generated configuration data for all of the providers defined in your config file | ||
> In case of dynamic access to a non pre-configured provider, it's automatically added to the `config` list on first access to the `/connect/:provider` route | ||
There is a `_config` property attached as well, which contains the data from the [config/oauth.json][oauth-config] file as well as all of the configuration methods used internally by Grant | ||
> Typically you don't want to use the `_config` property directly. Also note that changes made to the `config` property are per Grant instance, where changes to the `_config` property are global | ||
## Response Data | ||
@@ -488,4 +507,5 @@ | ||
[development-environments]: #development-environments | ||
[programmatic-access]: #programmatic-access | ||
[response-data]: #response-data | ||
[typical-flow]: #typical-flow | ||
[get-user-profile]: #get-user-profile |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71619
1399
505
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedasync@2.6.4(transitive)
+ Addedbl@1.0.3(transitive)
+ Addedbluebird@2.11.0(transitive)
+ Addedcaseless@0.11.0(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@1.0.1(transitive)
+ Addedgenerate-function@2.3.1(transitive)
+ Addedgenerate-object-property@1.2.0(transitive)
+ Addedhar-validator@1.8.0(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhawk@3.1.3(transitive)
+ Addedhttp-signature@0.11.0(transitive)
+ Addedis-my-ip-valid@1.0.1(transitive)
+ Addedis-my-json-valid@2.20.6(transitive)
+ Addedis-property@1.0.2(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedjsonpointer@5.0.1(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedoauth-sign@0.8.2(transitive)
+ Addedprocess-nextick-args@1.0.7(transitive)
+ Addedqs@4.0.0(transitive)
+ Addedreadable-stream@2.0.6(transitive)
+ Addedrequest@2.59.0(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedasync@0.9.2(transitive)
- Removedbl@0.9.5(transitive)
- Removedcaseless@0.9.0(transitive)
- Removedcombined-stream@0.0.7(transitive)
- Removeddelayed-stream@0.0.5(transitive)
- Removedforever-agent@0.5.2(transitive)
- Removedform-data@0.2.0(transitive)
- Removedhawk@2.3.1(transitive)
- Removedhttp-signature@0.10.1(transitive)
- Removedisarray@0.0.1(transitive)
- Removedmime-db@1.12.0(transitive)
- Removedmime-types@2.0.14(transitive)
- Removedoauth-sign@0.6.0(transitive)
- Removedqs@2.3.32.4.1(transitive)
- Removedreadable-stream@1.0.34(transitive)
- Removedrequest@2.53.0(transitive)
Updatedqs@4.0.0
Updatedrequest@2.59.0