Laravel Socialite: InvalidStateException

后端 未结 25 983
感动是毒
感动是毒 2020-11-27 13:56

I\'m using Laravel Socialite to add a Facebook connect button on a website. Sometimes, I\'ve got this error on callback:

exception \'Laravel\\Socialite\\Two\         


        
25条回答
  •  有刺的猬
    2020-11-27 14:23

    Laravel: 7.10.3

    PHP: 7.3.15

    I was having this issue too. Somehow the proposed solutions didn't help me getting the problem fixed.

    After spending a lot of time trying to fix my code, i thought this also could have to do something with my php-fpm -> nginx setup.

    After changing my nginx configuration loging in via Facebook now works.

    INCORRET CONFIGURATION:

    location ~ \.(php|phar)(/.*)?$ {
        fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;
        fastcgi_intercept_errors on;
        fastcgi_index  index.php;
        include        fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO $fastcgi_path_info;
        fastcgi_pass   unix:/var/run/php-fpm/www.sock;
    }
    
    location / {
       try_files $uri $uri/ /index.php;
    }
    

    CORRECT CONFIGURATION

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php-fpm/www.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
    

提交回复
热议问题