'Override Nuxt.js auth module's strategies parameters
Is there a way to override Nuxt.js auth module's strategies configuration ? For instance, can I move the redirect_uri parameter from nuxt.config.js to a method in pages/index.vue.
Authentication configuration in nuxt.config.js:
auth: {
strategies: {
'laravel.passport': {
url: 'http://laravel.test',
client_id: 2,
client_secret: 'S0gpcgfIDgbvIHCL3jIhSICAiTsTUMOR0k5mdaCi',
redirect_uri: 'http://localhost:3000'
}
}
}
Login method in pages/index.vue:
async login () {
await this.$auth.loginWith('laravel.passport', {
data: {
// All the 3 parameters below don't seem to be taken into account.
username: '[email protected]',
password: '1qaz@WSX',
// If 'redirect_uri' is removed from 'nuxt.config.js'
// and moved below, logging in returns an error.
redirect_uri: 'http://localhost:3000'
}
}).then((r) => {
console.log(r)
}).catch((e) => {
console.log(e)
})
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
