I'm building the backend with laravel and then using Vue as front-end. Data is accessed over api calls using axios. Now I have this relatively simple task but I can't seem to find the proper solution. I want one of the routes to be easily consumable by Vue compoenents without the need to log in, however I don't want that route to be publicly available for anyone to use. I'm talking about the GET request and not the POST request with a CSRF token.
Let me add an example, here it is my route:
Route::get('MyFAQS',[\App\Http\Controllers\FaqController::class,'getQuestions']);
And the vue js:
axios.get('api/MyFAQS').
then(response => {
this.FAQ = response.data;
console.log(this.FAQ);
})
.catch(error=>{
console.log("can not get FAQ: " + error)
})
In this situation anyone can do also a GET request to https://mywebsite.com/api/MyFAQS
and use my data on his website, how can I protect it?