最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

laravel - User is authenticated when refresh it gets log out? - Stack Overflow

programmeradmin0浏览0评论

I have a Nuxtjs 3 app and a Laravel project in production.

I have my custom Authentication system based on a token from the backend, token": "TOKEN FROM SANCTUM, and linked with the Nuxtjs project. Everything with it works perfectly locally.

When I deploy the Nuxt files on the production server the user is authenticated when refreshed it gets logged out!

So the system design now is:

  • Old Laravel app (example)
  • New Nuxt js project
  • my new API for the Nuxt app (api.example)

How do I deploy?

I run in Nuxt js project npm run generate and take all files that are in .output/public folder to the Laravel project(old one) and put it in public folder with this code in web.php:

Route::get('{any}', [RedirectableLinkController::class, 'show'])->where('any', '.*');

in RedirectableLinkController.php

public function show()
{
  return file_get_contents(public_path('index.html'));
}

I got the User is authenticated when refreshed it gets logged out!

even though there is a token in Cooike I do not know what is the problem ! and whats debug cuz the console does not show any error!:(

发布评论

评论列表(0)

  1. 暂无评论