Answer the question
In order to leave comments, you need to log in
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
https://laravel.ru/docs/v5/passport
app/Http/Kernel
'web' => [
// Другие посредники...
\Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question