It works fine on local but does not work on server.
my local image
On the server image
I use Laravel 5.8 and vuejs
is domain https
My problem was solved, the app.js file on the host was not Compiled correctly, and I uploaded it locally
Related
I have developed a front (react) and a back (php laravel) with the authentication system "sanctum". All is working fine on localhost. But I can't get it to work in production in heroku.
In local environment ,my .env is (extract) :
SESSION_DRIVER=cookie
SANCTUM_STATEFUL_DOMAINS=localhost:3000,127.0.0.1:3000,localhost:8000,127.0.0.1:8000
SESSION_DOMAIN=localhost
If I have understood well, the front and back must be on the same domains for the cookies. As my back and front are hosted in heroku (herokuapp.com), I have these .env :
But with this configuration, I always have a response 419 CSRF token mismatch.
Certainly my conf is not correct. But I tried a lot of things without success.
edit :
The back url is: https://school-back-v2.herokuapp.com/
The front url is: https://react-protected-routes.herokuapp.com/
Heroku is blacklisted by browsers to use cookie if you site placed on Heroku subdomain. You can use Heroku, but must to register your own domain and use it, so that resolve this problem.
Other variant - use tokens instead cookie.
I am trying to get users notification like this
Auth::user()->notifications
but it is not fetching notification for this user. It is working fine on localhost and it was also working fine on live server before i have just changed aws instance and database connection now.
It is also working fine in api can't get why it is not working in laravel blade
Can't seem to work out why I keep getting CSRF token mismatch with my deployed app. On local using valet it's working fine.
The backend and frontend are on 2 different servers but they share the same subdomain so surely this should work?
My local .env contains the following:
SESSION_DOMAIN=.rss.test
SANCTUM_STATEFUL_DOMAINS=front.rss.test:3001
My live .env contains the following:
SESSION_DOMAIN=.dally.tech
SANCTUM_STATEFUL_DOMAINS=rss.dally.tech
The API is sat on the domain:
rss-api.dally.tech
Really confused why this isn't working.
i'm a learning nuxt js and laravel, I have been doing an api with laravel and the front with nuxt js, when i work on localhost everything works fine but when i upload my api to a remote server the error appears on my nuxt app {"error":"Token is no provided"} this only happens when the api is on the remote server
my nuxt config looks like this
everything works fine on localhost, but not on the remote server, and on the internet I hardly find any information about it, thanks
in my laravel authController i have this
i just uploaded a Laravel 5.8 Project in my Bluehost hosting. Every thing is set. When login to the application it is showing 419 Page Expired Exception. I used #csrf and in post request.
in my local machine it is running perfectly. When i purchased domain bluehost provided me wordpress hosting and i removed all wordpress files in the domain and uploaded Laravel Project.
You may make a route like
Route::get('/clear',function(){
Artisan::call('view:clear');
Artisan::call('route:clear');
Artisan::call('config:cache');
Artisan::call('cache:clear');
});
then run from the browser like
http://your-app.com/clear
Hope this may help you. Thanks.