Closed nitinsinghnaruka closed 5 years ago
This issue as been imported as question since it does not respect auth-module issue template. Only bug reports and feature requests stays open to reduce maintainers workload. If your issue is not a question, please mention the repo admin or moderator to change its type and it will be re-opened automatically. Your question is available at https://cmty.app/nuxt/auth-module/issues/c326.
Same here…
yep same
Same
Same
Same
for me my template was this:
<button @click="login()">Login with Google</button>
adding .prevent
solved it
<button @click.prevent="login()">Login with Google</button>
For people using Laravel Passport and basic /user
route in api.php
, you need to specify propertyName in strategy like this, also remember to have correct route prefix.
strategies: {
local: {
endpoints: {
login: {
url: 'api/login',
method: 'post',
propertyName: 'access_token'
},
user: { url: 'api/user', method: 'get', propertyName: false } //here
},
tokenType: 'Bearer',
tokenRequired: true
}
},
redirect: {
login: '/login',
logout: '/login',
home: '/dashboard',
user: '/dashboard'
}
I think my issue was related to not specifying all the properties of the redirect
key.
auth: { strategies: { local: { endpoints: { login: { url: '/login', method: 'post', propertyName: false }, logout: { url: '/logout', method: 'post' }, user: { url: '/user', method: 'get', propertyName: false } }, // tokenRequired: true, // tokenType: 'Bearer', // Case sensitive when dealing with Laravel backend. } }, redirect: { login: '/login', logout: '/', callback: '/login', home: '/dashboard' } },
router: { middleware: ['auth'] },
dashboard page export default { name: 'dashboard', layout: 'dashboard', }