Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSRF Token mismatch #1248

Open
robdid opened this issue Jun 19, 2023 · 3 comments
Open

CSRF Token mismatch #1248

robdid opened this issue Jun 19, 2023 · 3 comments

Comments

@robdid
Copy link

robdid commented Jun 19, 2023

Describe the bug
Unable to connect to Crater on another device on my local network. I tried multiple browsers and devices including incognito mode. I always get the error « CSRF token mismatch » (see screenshot).

Crater was installed on a M1 iMac via the terminal with Docker Desktop running in the background. I followed the steps from the install guide and then accessed the iMac’s localhost through its IP adress on the local network.

Crater is running fine on the iMac.

I tried creating other users on crater but the authentification on the other devices still failed.

Screenshots
IMG_1440

Please complete the following information:

  • Crater version: 6.06
  • PHP version: 8.1.20

Optional info

  • OS: Mac OS 13.4
  • Hardware: M1 iMac
  • Browser: chrome/safari/arc
@lemiliomoreno
Copy link

I had the same error when installing via Docker compose, running in an Ubuntu VM, everything was working fine until I restarted the VM

These are the API calls that the app is doing:

imagen

Bootstrap call response:

{"message":"Unauthenticated."}

Logout call response:

{
    "message": "CSRF token mismatch.",
    "exception": "Symfony\\Component\\HttpKernel\\Exception\\HttpException",
    "file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",
    "line": 389,
    "trace": [
        {
            "file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",
            "line": 332,
            "function": "prepareException",
            "class": "Illuminate\\Foundation\\Exceptions\\Handler",
            "type": "->"
        },
        {
            "file": "/var/www/app/Exceptions/Handler.php",
            "line": 51,
            "function": "render",
            "class": "Illuminate\\Foundation\\Exceptions\\Handler",
            "type": "->"
        },
        ...
        {
            "file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 111,
            "function": "sendRequestThroughRouter",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/var/www/public/index.php",
            "line": 59,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        }
    ]
}

@lemiliomoreno
Copy link

The issue happened to me because the IP of the VM changed, so I had to update the .env file with the new IP, these are the variables that I changed with the new IP:

APP_URL=
SANCTUM_STATEFUL_DOMAINS=
SESSION_DOMAIN=

And its working now

@Brukkil
Copy link

Brukkil commented Jul 5, 2023

https://docs.craterapp.com/upgrade-guide.html#step-4-add-required-environment-variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants