Anyone?
Consuming Your API With JavaScript (Passport + VUE)
Hello,
Hope someone can enlighten me on this matter.
Im using Laravel Passport + VUE to make some calls, and I want 2 types of calls to pass.
- The ones that come authenticated (with the "authorization bearer") - This is working OK!
- The ones that are done internally on the website via VUE
Example:
Route::middleware('auth:api')->get('/domains/whois/{domain?}', '\App\XPTO\XPTO@DomainWhois');
Now, I want this internal request to be made by the VISITOR (not authenticated user) on my website. And the request should only be accepted because it comes from the website (via the X-XSRF-TOKEN or X-CSRF-TOKEN).
I followed the instructions: https://laravel.com/docs/5.4/passport#consuming-your-api-with-javascript. Assuming the token of visitor site will be enough, but:
I always get
{"error":"Unauthenticated."}
Now is this possible? Or in order consume my API With JavaScript I have to somehow authenticate the Visitor? and if so, how can I achieve this?
Hope I have been clear.
Cheers, David
Please or to participate in this conversation.