Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
How do i pass in a header from axios before a accessing a controller

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'}
});

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You should add the x-requested-with header with XMLHttpRequest as value.

Checkout the following example:

headers: {
  'Bearer Token': 'foobar515615612655',
  'x-requested-with' : 'XMLHttpRequest'
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!