Skip to content

Commit

Permalink
fix(providers): add nuxt parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoPedroAS51 committed Apr 18, 2020
1 parent cffa385 commit 61f4784
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion module/providers/auth0.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assignDefaults } from '../utils'

export function auth0 (strategy) {
export function auth0 (nuxt, strategy) {
assignDefaults(strategy, {
_scheme: 'oauth2',
endpoints: {
Expand Down
2 changes: 1 addition & 1 deletion module/providers/facebook.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assignDefaults } from '../utils'

export function facebook (strategy) {
export function facebook (nuxt, strategy) {
assignDefaults(strategy, {
_scheme: 'oauth2',
endpoints: {
Expand Down
4 changes: 2 additions & 2 deletions module/providers/github.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assignDefaults, addAuthorize } from '../utils'

export function github (strategy) {
export function github (nuxt, strategy) {
assignDefaults(strategy, {
_scheme: 'oauth2',
endpoints: {
Expand All @@ -11,5 +11,5 @@ export function github (strategy) {
scope: ['user', 'email']
})

addAuthorize.call(this, strategy)
addAuthorize(nuxt, strategy)
}
2 changes: 1 addition & 1 deletion module/providers/google.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assignDefaults } from '../utils'

export function google (strategy) {
export function google (nuxt, strategy) {
assignDefaults(strategy, {
_scheme: 'oauth2',
endpoints: {
Expand Down
4 changes: 2 additions & 2 deletions module/providers/laravel.passport.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assignDefaults, addAuthorize } from '../utils'

export function laravelPassport (strategy) {
export function laravelPassport (nuxt, strategy) {
assignDefaults(strategy, {
_scheme: 'oauth2',
_name: 'laravel.passport',
Expand All @@ -23,5 +23,5 @@ export function laravelPassport (strategy) {
scope: '*'
})

addAuthorize.call(this, strategy)
addAuthorize(nuxt, strategy)
}
4 changes: 2 additions & 2 deletions module/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function assignDefaults (strategy, defaults) {
Object.assign(strategy, defu(strategy, defaults))
}

export function addAuthorize (strategy) {
export function addAuthorize (nuxt, strategy) {
// Get clientSecret, clientId, endpoints.token and audience
const clientSecret = strategy.clientSecret
const clientID = strategy.clientId
Expand All @@ -27,7 +27,7 @@ export function addAuthorize (strategy) {
const formMiddleware = bodyParser.urlencoded({ extended: true })

// Register endpoint
this.options.serverMiddleware.unshift({
nuxt.options.serverMiddleware.unshift({
path: endpoint,
handler: (req, res, next) => {
if (req.method !== 'POST') {
Expand Down

0 comments on commit 61f4784

Please sign in to comment.