Hey,
i use vue and axois to create a api request to my controller to get the data i need, but there is a problem. I dont know how i can send the Auth data or any tokens to auth. (I use Steam Auth)
My Request:
axios.get('api/employee/towyard').then((res) => {
console.log(res.data)
})
The controller auth check:
public function __construct() {
$this->middleware('auth');
}
@willvincent Yes i use this already. Now i want to send a api get request whit axois to the controller when a specific site is loaded and get some data of this, but i want to allow the API request only auth user (checked by the "auth" middleware). Do you understand what i mean ?
@jaseofspades88 Yes but how do I send this data with my axois get query so that only someone who is logged in with the Steam account has access to it ?
public function __construct() {
$this->middleware('auth');
}
public function get() {
$towyards = Towyard::where('status', 'standing')->orWhere('status', 'waiting')->orderBy('server')->orderBy('created_at', 'desc')->get();
return new Response($towyards, Response::HTTP_OK);
}
So now i have the problem with the "auth" middleware, because idk how i can send auth data with axois (steam auth)
@Elias177 are you authenticated at this point or do you have an endpoint for authenticating? Is this 'api' endpoint going to be used purely from inside your application?
@jaseofspades88 When the axois query is made the user is authenticated. The request goes to the api.php and from there to the controller. However, I do not know how to transmit the auth data (steam) with axois