Allow Inertia's axios instance to have headers configurable #2283
nicholaspufal
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
A current limitation is that the axios instance that Inertia leverages in all of its composables (e.g.
useForm
) is tied to session authentication (browser cookies), i.e. we cannot simply provide a customAuthorization
header that leverages an OAuth bearer token for all of its requests for example within the SPA.This is problematic for many projects out there that may control session expiration differently and at the moment have no other way around it.
I think allowing configurable default headers to be passed down from the SPA's initialization could be a good way to address the limitation. Teams could provide a callback for example to make sure they are using fresh tokens for these requests (or at the very least computed properties)
Beta Was this translation helpful? Give feedback.
All reactions