is there a way to inject axios.get() header into a route request before the controller is accessed.
Please not that a link with the url (/verify) was sent to the users email via api and i want to include the bearer token then the user clicks the url.
This is my route from web.php
Route::get('/verify-email', [VerifyEmailController::class, '__invoke'])
->middleware(['signed', 'throttle:6,1'])
->name('verification.verify');
And this is create in a js folder
import axios from 'axios'
axios.create({
baseURL: '/verify-email',
headers: {'Bearer Token': 'foobar515615612655'}
});
You should add the x-requested-with header with XMLHttpRequest as value.
Checkout the following example:
headers: {
'Bearer Token': 'foobar515615612655',
'x-requested-with' : 'XMLHttpRequest'
}