Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda