skip to Main Content

I am building some applications with Laravel as the backend and react as the front end. So, I used the standard Laravel instruments – session, Auth facade, and custom controller. It works because I put react in the resources/js folder and connected it in one blade view file (It uses the same domain as the Laravel app). However, I hesitated a little. Is it Okay to use standard session auth while using react? Or should I use JWTt (I haven’t learned how to use JWT yet)?

I tried to use laravel/breeze, but I got a lot of errors like (cors, csrf, 419, 401), and I can’t make it up with laravel starter kits. So I feel like standard auth using a session is the most comfortable, So I need advice; what should I use? Is it okay to use just session auth like it using with a blade in the standard Laravel app? If you have some good tutorials about the Laravel + React app, I would appreciate it if you share them because I’ve watched a lot and still can’t make it.

2

Answers


  1. Don’t be stressed about it, JWT is very simple and easy just go through some blogs/videos and you can understand it pretty well. Here are some links …

    https://blog.logrocket.com/implementing-jwt-authentication-laravel-9/

    https://blog.pusher.com/laravel-jwt/

    https://youtu.be/jIzPuM76-nI

    I have built so many projects using Laravel 8 and Laravel 9 with React Front-end.

    Build APIs in Laravel with JWT auth token security and just implement it in your React Frontend.

    I hope this info can help you.

    Login or Signup to reply.
  2. Don’t be stressed out.

    You can do it just by the sanctum package.

    It provides CSRF protection and follows natural Laravel session authentication flow.

    I use Laravel and ReactJS completely separate.

    Make some wrappers and use them without a headache.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search