External Sign In Issues: Laravel\Socialite\Two\InvalidStateException #2293

Closed
opened 2026-02-05 03:35:16 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @FuzzySlug on GitHub (Jun 14, 2021).

Describe the bug
When using external sign in, such as Google or Discord, users are unable to sign in and it takes them to an error page. Upon turning Debug On... The error specifically resides within Laravel\Socialite\Two\InvalidStateException

Image below shows the debug screen.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Follow instructions to add Google and Discord external sign in options
  2. Clear Cache
  3. Navigate to Sign In Screen
  4. Click on Login with Google or Login with Discord
  5. See Error

Expected behavior
User is logged in with their Google or Discount account

Screenshots
https://i.imgur.com/SzDGtKD.png

Your Configuration (please complete the following information):

  • Exact BookStack Version (Found in settings): v21.05.2
  • PHP Version: 7.4
  • Hosting Method (Nginx/Apache/Docker): Nginx

Additional context
First-time, fresh install of BookStack.

Originally created by @FuzzySlug on GitHub (Jun 14, 2021). **Describe the bug** When using external sign in, such as Google or Discord, users are unable to sign in and it takes them to an error page. Upon turning Debug On... The error specifically resides within Laravel\Socialite\Two\InvalidStateException Image below shows the debug screen. **Steps To Reproduce** Steps to reproduce the behavior: 1. Follow instructions to add Google and Discord external sign in options 2. Clear Cache 3. Navigate to Sign In Screen 4. Click on Login with Google or Login with Discord 5. See Error **Expected behavior** User is logged in with their Google or Discount account **Screenshots** [https://i.imgur.com/SzDGtKD.png](https://i.imgur.com/SzDGtKD.png) **Your Configuration (please complete the following information):** - Exact BookStack Version (Found in settings): v21.05.2 - PHP Version: 7.4 - Hosting Method (Nginx/Apache/Docker): Nginx **Additional context** First-time, fresh install of BookStack.
Author
Owner

@ssddanbrown commented on GitHub (Jun 15, 2021):

Hi @FuzzySlug,
This is likely either due to the session system not functioning or due to URLs being incorrectly handled so that query parameters do not work as expected.

Could you share your nginx configuration for BookStack or share any guide you used to install? You can omit any sensitive details. Ideally, also confirm the operating system in use.

@ssddanbrown commented on GitHub (Jun 15, 2021): Hi @FuzzySlug, This is likely either due to the session system not functioning or due to URLs being incorrectly handled so that query parameters do not work as expected. Could you share your nginx configuration for BookStack or share any guide you used to install? You can omit any sensitive details. Ideally, also confirm the operating system in use.
Author
Owner

@FuzzySlug commented on GitHub (Jun 21, 2021):

Hello, here is my nginx configuration with the domains hidden. I am also using Ubuntu 20.04.2
server {

root /var/www/wiki/public;
index index.php;
server_name -;

location / {
try_files $uri $uri/ /index.php$query_string;
}

location ~ .php$ {
try_files $uri /index.php =404;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/-/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/-/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
if ($host = -) {
return 301 https://$host$request_uri;
} # managed by Certbot

listen 80;
server_name -;
return 404; # managed by Certbot

}

@FuzzySlug commented on GitHub (Jun 21, 2021): Hello, here is my nginx configuration with the domains hidden. I am also using Ubuntu 20.04.2 server { root /var/www/wiki/public; index index.php; server_name -; location / { try_files $uri $uri/ /index.php$query_string; } location ~ \.php$ { try_files $uri /index.php =404; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/-/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/-/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = -) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; server_name -; return 404; # managed by Certbot }
Author
Owner

@ssddanbrown commented on GitHub (Jun 21, 2021):

Hi @FuzzySlug,
Within your first location block, I think you're missing a question mark, You have:

location / {
    try_files $uri $uri/ /index.php$query_string;
}

But this should be:

location / {
   try_files $uri $uri/ /index.php?$query_string;
}
@ssddanbrown commented on GitHub (Jun 21, 2021): Hi @FuzzySlug, Within your first location block, I think you're missing a question mark, You have: ```nginx location / { try_files $uri $uri/ /index.php$query_string; } ``` But this should be: ```nginx location / { try_files $uri $uri/ /index.php?$query_string; } ```
Author
Owner

@FuzzySlug commented on GitHub (Jun 22, 2021):

Hi @FuzzySlug,
Within your first location block, I think you're missing a question mark, You have:

location / {
    try_files $uri $uri/ /index.php$query_string;
}

But this should be:

location / {
   try_files $uri $uri/ /index.php?$query_string;
}

That fixed the issue! Thank you very much!!

@FuzzySlug commented on GitHub (Jun 22, 2021): > Hi @FuzzySlug, > Within your first location block, I think you're missing a question mark, You have: > > ```nginx > location / { > try_files $uri $uri/ /index.php$query_string; > } > ``` > > But this should be: > > ```nginx > location / { > try_files $uri $uri/ /index.php?$query_string; > } > ``` That fixed the issue! Thank you very much!!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2293