Pass Headers on a route in Laravel

0

Good Night, I am working with Laravel 5.3 on a solution, as it is an API application, I chose to use Laravel Passport as authentication. I'm having a hard time loading the Token into the page header, I'm able to log in, return the access token, the refresh token. But I can not start the routes with a custom header with the information archived in LocalSession. Via postman I usually authenticate the access, but via Laravel I still could not add the "Authorization" information in the header of the routes, I tried to add via header () in the view but it does not work because the auth: api middleware redirects the page before it is opened . My question is, how do I get the tokens to the page header on the route before the middleware kicks in? Thank you.

    
asked by anonymous 21.12.2016 / 00:48

1 answer

-2

Are you using the frontend? Vuejs? Post your architecture. I am also using laravel / passport in my API and as I am using vueses I am doing so:

  

Vue.http.headers.common ['Authorization'] = auth.getJwtBearer ();

With this configuration, in all http requests, it points to the token in the header

auth.getJwtBearer () is a service that I created that after the user is authenticated it saves the token and this function returns me 'Bearer token_id'

    
25.04.2017 / 23:58