Bug Keycloak & Bookstack Integration #4414

Closed
opened 2026-02-05 08:50:31 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @gugigunawan on GitHub (Jan 18, 2024).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

Hello Dan,

i write new issue for integration between Keycloak and BookStack as instruction you gave to me for opening new Issue.
The issue still the same, after make sure the Time Zone between Host and Docker Image is same but the Error have still appear.

image

I check the response after click "Login with Keycloak" is 200 but the page not redirect to BookStack Page instead have go back to home page.

image

Exact BookStack Version

v23.10.12

Log Content

No response

Hosting Environment

OS VM : 22.04 LTS
BookStack Image Version : v23.10.2

Originally created by @gugigunawan on GitHub (Jan 18, 2024). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario Hello Dan, i write new issue for integration between Keycloak and BookStack as instruction you gave to me for opening new Issue. The issue still the same, after make sure the Time Zone between Host and Docker Image is same but the Error have still appear. <img width="887" alt="image" src="https://github.com/BookStackApp/BookStack/assets/9584750/66d48e9e-5f20-4e0c-81b8-cddc424d30e5"> I check the response after click "Login with Keycloak" is 200 but the page not redirect to BookStack Page instead have go back to home page. <img width="960" alt="image" src="https://github.com/BookStackApp/BookStack/assets/9584750/9e61561d-ff41-4c88-89fe-e867fca16522"> ### Exact BookStack Version v23.10.12 ### Log Content _No response_ ### Hosting Environment OS VM : 22.04 LTS BookStack Image Version : v23.10.2
OVERLORD added the 🐕 Support label 2026-02-05 08:50:31 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jan 18, 2024):

Hi @gugigunawan,
How are you hosting Keycloak, have you checked the time of the Keycloak's host system/container?

@ssddanbrown commented on GitHub (Jan 18, 2024): Hi @gugigunawan, How are you hosting Keycloak, have you checked the time of the Keycloak's host system/container?
Author
Owner

@gugigunawan commented on GitHub (Jan 22, 2024):

Hi,

i install Keycloak using this tutorial https://www.keycloak.org/getting-started/getting-started-zip
Yes, i already check it and already same TZ between Keycloak and Bookstack Server

@gugigunawan commented on GitHub (Jan 22, 2024): Hi, i install Keycloak using this tutorial https://www.keycloak.org/getting-started/getting-started-zip Yes, i already check it and already same TZ between Keycloak and Bookstack Server
Author
Owner

@ssddanbrown commented on GitHub (Jan 22, 2024):

Yes, i already check it and already same TZ between Keycloak and Bookstack Server

The timezone should not matter.
Have you checked the actual time on the keycloak server? Is it aligned with the time on the BookStack server?

@ssddanbrown commented on GitHub (Jan 22, 2024): > Yes, i already check it and already same TZ between Keycloak and Bookstack Server The timezone should not matter. Have you checked the actual time on the keycloak server? Is it aligned with the time on the BookStack server?
Author
Owner

@gugigunawan commented on GitHub (Jan 23, 2024):

Yes, it's actually same between those 2 Servers and i use NTP Server for Sync Time between Bookstack and Keycloak Server

Any suggestion beside time problem for this problem ?

Best Regards,

@gugigunawan commented on GitHub (Jan 23, 2024): Yes, it's actually same between those 2 Servers and i use NTP Server for Sync Time between Bookstack and Keycloak Server Any suggestion beside time problem for this problem ? Best Regards,
Author
Owner

@ssddanbrown commented on GitHub (Jan 23, 2024):

Any suggestion beside time problem for this problem ?

Not anything else easy to check. The next step would be doing some deeper inspection into what your keycloak server is providing to BookStack, to inspect the iat value of the OIDC ID Token.

Here's the relevant code in BookStack which throws this error:
295cd01605/app/Access/Oidc/OidcIdToken.php (L208-L212)

Just before this, we check that the iat is set, so it should be there.
We then check the time given is within a certain window, with a fair bit of leeway (2 mins forward, 1 day back).
We'd need to see what iat is being provided in your token to understand anything more.
There's not a direct easy way to dump that though, without going inside the container to modify code at the point reflected above.

@ssddanbrown commented on GitHub (Jan 23, 2024): > Any suggestion beside time problem for this problem ? Not anything else easy to check. The next step would be doing some deeper inspection into what your keycloak server is providing to BookStack, to inspect the `iat` value of the OIDC ID Token. Here's the relevant code in BookStack which throws this error: https://github.com/BookStackApp/BookStack/blob/295cd0160525125bbd7756d7ad07392ae7201cb8/app/Access/Oidc/OidcIdToken.php#L208-L212 Just before this, we check that the `iat` is set, so it should be there. We then check the time given is within a certain window, with a fair bit of leeway (2 mins forward, 1 day back). We'd need to see what `iat` is being provided in your token to understand anything more. There's not a direct easy way to dump that though, without going inside the container to modify code at the point reflected above.
Author
Owner

@ssddanbrown commented on GitHub (Mar 9, 2024):

Since there's been no further follow-up I'm going to close this. If you need further help just respond to my previous comment.

@ssddanbrown commented on GitHub (Mar 9, 2024): Since there's been no further follow-up I'm going to close this. If you need further help just respond to my previous comment.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4414