Skip to content

Commit

Permalink
feat: allow providers params to be overloaded from nuxt.config.js (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
syffs authored and pi0 committed Mar 5, 2018
1 parent be65f09 commit 8542959
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion examples/demo/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ module.exports = {
client_id: 'q8lDHfBLJ-Fsziu7bf351OcYQAIe3UJv'
},
facebook: {
client_id: '1671464192946675'
client_id: '1671464192946675',
userinfo_endpoint: 'https://graph.facebook.com/v2.12/me?fields=about,name,picture{url},email,birthday',
scope: ['public_profile', 'email', 'user_birthday']
},
google: {
client_id:
Expand Down
2 changes: 1 addition & 1 deletion lib/auth/providers/_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const axios = require('axios')
const bodyParser = require('body-parser')

function assignDefaults (strategy, defaults) {
Object.assign(strategy, defaults, strategy)
Object.assign(strategy, Object.assign({}, defaults, strategy))
}

function addAuthorize (strategy) {
Expand Down
10 changes: 5 additions & 5 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ function processStrategy (strategy, name, ctx) {
strategy._provider = strategy._name
}

// _scheme property
if (!strategy._scheme) {
strategy._scheme = strategy._name
}

// Apply provider
if (ctx.providers[strategy._provider]) {
ctx.providers[strategy._provider].call(this, strategy, ctx)
}

// _scheme property
if (!strategy._scheme) {
strategy._scheme = strategy._name
}

// Resolve _scheme
if (SCHEMES.includes(strategy._scheme)) {
strategy._scheme = `./schemes/${strategy._scheme}.js`
Expand Down

0 comments on commit 8542959

Please sign in to comment.