Im usgin Laravel Sanctum auth for my API. When i try to make a call to an endpoint that is handled by 'auth:sanctum' middleware, i cannot put the 'Authorization' header cause if i use it, i get the error "GET http://myapi.host.com/api/user net::ERR_EMPTY_RESPONSE".
I tought that could be my server config but donde this with Postman and it works fine, but it does not in browser.
Does anyone know why this happends?
I'm usgin Angular in an Ionic app This is my API call
const headers = new HttpHeaders({
Authorization: `Bearer ${await this.apiHelper.getToken()}`
});
this.http
.get(`${this.uri}/api/user`, {
headers: headers,
})
.subscribe(
(res) => console.log(res),
(error) => console.log(error)
);
this is the message i get: "GET http://myapi.host.com/api/user net::ERR_EMPTY_RESPONSE"
if i try a call without 'Authorization' header it works, like this:
this.http
.get(`${this.uri}/api/user`)
.subscribe(
(res) => console.log(res),
(error) => console.log(error)
);
and i get this: "GET http://myapi.host.com/api/user 401 (Unauthorized)" so i cannot authenticate anything