-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
Description
Environment
@nuxt-alt/auth 3.1.4
@nuxt-alt/http 1.7.10
node 18.18.2
npm 9.8.1
vue 3.3.8
nuxt 3.8.2
Nuxt Config
auth: {
stores: {
state: {
namespace: "auth",
},
pinia: {
enabled: false,
},
cookie: {
enabled: true,
options: {
maxAge: 31536000,
},
},
},
strategies: {
local: {
scheme: "local",
url: process.env.API_URL,
endpoints: {
login: {
baseURL: process.env.API_URL,
url: "login",
method: "post",
},
logout: {
baseURL: process.env.API_URL,
url: "logout",
method: "post",
},
user: {
baseURL: process.env.API_URL,
url: "me",
method: "get",
},
},
user: {
property: "data.attributes",
},
token: {
property: "access_token",
global: true,
maxAge: 60 * 1,
},
},
},
},
Reproduction
Can't reproduce.
Describe the bug
When I try to login, '_auth/local/local1/authorize' API is called.
Its response is the html source of the page.
The response seems to be used as the me API's request header, and it fails.
What should the response format of the authorize API be?
Additional context
■Login code
await this.$auth.loginWith("local", {
body: {
email: email@xxx,
password: password,
},
});
■The request body of the authorize API
Logs
FetchError: [GET] "http://localhost/api/v1/user/me?include=roles.permissions": <no response> Failed to execute 'fetch' on 'Window': Failed to read the 'headers' property from 'RequestInit': String contains non ISO-8859-1 code point.Caused by: TypeError: Failed to execute 'fetch' on 'Window': Failed to read the 'headers' property from 'RequestInit': String contains non ISO-8859-1 code point.
at $fetchRaw2 (ofetch.js?v=3b6afd57:297:32)
at onError (ofetch.js?v=3b6afd57:232:16)
at AsyncFunction.$fetchRaw2 [as raw] (ofetch.js?v=3b6afd57:306:20)