The ->with() function attaches session data to the request; your authentication stuff should go in the request headers, for which you’d use ->header() or ->withHeaders().
Oct 3, 2022
6
Level 3
How to redirect from a public api endpoint, to an endpoint that requires authentification?
Hello, I am having an issue with redirections.
I Have a public route, to which I make a GET request, and pass the "plaintTextToken" as the parameter in the URL. In the public endpoint, I want to redirect to an endpoint that requires authentification. But the app does not take into consideration the bearer token that I passed. Used auth middleware is "sanctum".
return redirect()->route("protected_route", [
"filteName" => $request->query("filteName"),
])->with([
"Accept" => "application/json",
"Authorization" => "Bearer " . $request->query("plainTextToken"),
]);
It is a local redirection. Pls help :)
Please or to participate in this conversation.