O
O
on_click2021-07-01 15:15:59
Laravel
on_click, 2021-07-01 15:15:59

How to execute graphql queries requiring bearer token via js. Laravel+LighthouseGraphQl+Passport?

Greetings!

GraphQl is used for mobile applications, I want to use it for some requests from the site.

In the application, the login mutation first leaves, the access token is taken from the response, and then it is passed as a header for all requests requiring authorization.

On the site, authorization occurs using the standard component generated by php artisan ui bootstrap --auth I

thought to modify it, and generate the same access token when logging in, put it in cookies and take it from there when js requests, but I think this is not the best idea.

Can you please tell me how this usually happens?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
on_click, 2021-07-01
@on_click

https://laravel.ru/docs/v5/passport
app/Http/Kernel

'web' => [
  // Другие посредники...
  \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,
],

P
pLavrenov, 2021-07-01
@pLavrenov

Apollo Auth

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question