I looked at the available resources and got confused and wanted to get some expert advice if possible.
I have a Vue page with a form on it. The page is public and acts as a landing page. When the user submits the form it should be sent to a protected endpoint which is basic token protected.
So how would I securely store and pass the token as part of the request?
Looking at the options I cannot find a secure solution for handling the tokens :(
@tnort Follow Sanctum’s example and request a CSRF token from the server, and then submit that token as part of the form. The form will only be handled if it is submitted alongside a valid CSRF token, then.
@martinbean, ok the CSRF token makes sense but I don't think I need it. I am worried about the basic token that I need to store/get from somewhere and pass it as part of the request to authenticate the endpoint.
@martinbean assuming I can read it from the env file. The problem is there is a protected route which needs that token. I am worried that it's not safe to send the token directly from the vue component.
@tnort Why is a user authentication token in an .env file? That makes no sense. You don’t want to be sending anything from your .env file to the client side.
@martinbean, I am not sending anything to the client, I inherited an API which is Basic Token Protected, thus when I submit a form I need to post the user inputs to that endpoint.