I have created a new project very similar to demo in examples.
the API provides tokens correctly, However, instead of token value, the token type is set for Authorization.


Server Error :
`
ERROR Format is Authorization: Bearer [token] 05:10:48
at middleware (node_modules/express-jwt/lib/index.js:70:21)
at node_modules/express-unless/index.js:47:5
at Layer.handle [as handle_request] (node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (node_modules/express/lib/router/index.js:317:13)
at node_modules/express/lib/router/index.js:284:7
at Function.process_params (node_modules/express/lib/router/index.js:335:12)
at next (node_modules/express/lib/router/index.js:275:10)
at jsonParser (node_modules/body-parser/lib/types/json.js:110:7)
at Layer.handle [as handle_request] (node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (node_modules/express/lib/router/index.js:317:13)
at node_modules/express/lib/router/index.js:284:7
at Function.process_params (node_modules/express/lib/router/index.js:335:12)
at next (node_modules/express/lib/router/index.js:275:10)
at cookieParser (node_modules/cookie-parser/index.js:71:5)
at Layer.handle [as handle_request] (node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (node_modules/express/lib/router/index.js:317:13)
`
Hi @mjzarrin! Can you show me your auth config?
Hi @mjzarrin! Can you show me your auth config?
Yeah, sure, Im using "@nuxtjs/auth": "^4.9.1" and here is the auth config part in the nuxt.config.js.
modules: [
'@nuxtjs/axios',
'@nuxtjs/dotenv',
'@nuxtjs/auth'
],
axios: {
proxy: true
},
proxy: {
'/api': 'http://localhost:3000'
},
auth: {
redirect: {
callback: '/callback',
logout: '/signed-out'
},
strategies: {
local: {
token: {
property: 'token.accessToken'
}
},
localRefresh: {
_scheme: 'refresh',
token: {
property: 'token.accessToken',
maxAge: 15
},
refreshToken: {
property: 'token.refreshToken',
data: 'refreshToken',
maxAge: false
},
clientId: {
property: 'token.clientId',
data: 'clientId'
},
grantType: {
data: 'grantType'
},
autoRefresh: true
}
}
},
serverMiddleware: ["~/api/auth"]
Thanks! So, you are receiving this error because this config is from dev branch that will be used for v5. (v5 wasn't released yet)
For v4.9.1 you should follow this demo
auth: {
redirect: {
callback: '/callback',
logout: '/signed-out'
},
strategies: {
local: {
endpoints: {
login: { propertyName: 'token.accessToken' }
}
}
}
},
Note: Refresh tokens aren't supported yet. If you need it for your project, then use dev branch instead of changing your config to the example above. To do so, add "@nuxtjs/auth": "nuxt-community/auth-module#dev" to your package.json.
You can see the new docs at https://dev.auth.nuxtjs.org/
@JoaoPedroAS51 ,
That's works.
Thank you so much!
Most helpful comment
Thanks! So, you are receiving this error because this config is from dev branch that will be used for v5. (v5 wasn't released yet)
For v4.9.1 you should follow this demo
Note: Refresh tokens aren't supported yet. If you need it for your project, then use dev branch instead of changing your config to the example above. To do so, add
"@nuxtjs/auth": "nuxt-community/auth-module#dev"to yourpackage.json.You can see the new docs at https://dev.auth.nuxtjs.org/