I'm trying to authenticate my api route with sanctum while using vue.js but I'm getting a headers error
bootstarp.js
axios.interceptors.request.use(function (config) { config.headers.common = { 'Authorization':
Bearer ${localStorage.getItem('token')}, 'Content-Type': 'application/json', 'Accept': 'application/json' } return config })
Getting this error:
DOMException: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': 'Bearer 100|paUaKhln1hiQUGWUyRshAC5fL8qS9qMhsR5n6CHd' is not a valid HTTP header field value.
Hey,
Sanctum tokens/cookie values are base64 encoded. The value you are passing as header is nothing that's Sanctum compatible. Where did you get that value from?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community