-
Notifications
You must be signed in to change notification settings - Fork 915
Description
Version
Reproduction link
https://codepen.io/joao-henrique-abreu/pen/xxwBrGZ
Steps to reproduce
[UPDATE]: I was able to "fix" this by disabling token (not sure this is ideal)
Prod (QA) setup: heroku app.
nuxt.config.js
Works on dev / doesn't work on prod:
auth: {
scopeKey: 'type',
strategies: {
local: {
endpoints: {
login: { url: 'login', method: 'post', propertyName: 'token'},
logout: { url: 'login', method: 'delete' },
user: { url: 'validate', method: 'post', propertyName: 'user'}
}
},
}
},
Works on prod:
auth: {
scopeKey: 'type',
strategies: {
local: {
endpoints: {
login: { url: 'login', method: 'post', propertyName: false },
logout: { url: 'login', method: 'delete' },
user: { url: 'validate', method: 'post', propertyName: false }
}
},
tokenRequired: false,
tokenType: false
}
},
The server gives the correct response on both cases (as i am able to login in dev).
Thanks to https://dev.to/mandeepm91/how-to-add-authentication-to-your-universal-nuxt-app-using-nuxt-auth-module-3ffm
I was able to make this work, but I suppose token
should be supported.
What is expected ?
I would expect enabling token to work on prod. Works perfectly on dev environment.
What is actually happening?
At login page when $auth.loginWith('local')
is called we get this error:
TypeError: Cannot use 'in' operator to search for 'token'
I briefly traced it and seems that it's trying to use in
against a string (minified):
...
if (t in e)
...
where t
is 'token'
and e
is the string of the whole html of the page.