mariovalney / laravel-keycloak-web-guard

Simple Keycloak Guard to Laravel Web Routes - https://packagist.org/packages/vizir/laravel-keycloak-web-guard
146 stars 80 forks source link

[Keycloak Error] Invalid state #53

Closed tigran73 closed 3 years ago

tigran73 commented 3 years ago

After registration gives me this error: Vizir\KeycloakWebGuard\Exceptions\KeycloakCallbackException [Keycloak Error] Invalid state

Callback URL: http://127.0.0.1:8000/callback?state=0a3b6de9f1b51403fe6bdead4b014921&session_state=34041c3e-8261-44a0-9750-0c62b886f19f&code=230400b8-d80a-4291-91e1-9bf74a278221.34041c3e-8261-44a0-9750-0c62b886f19f.ae4487bd-8c09-4da4-aeeb-930d48b35e87

File: vendor\vizir\laravel-keycloak-web-guard\src\Controllers\AuthController.php:72

Help me solve this problem

mariovalney commented 3 years ago

Hi! State is a value persisted to ensure the continuous of the auth flow. Check you are persisting it well.

Please check our README: https://github.com/Vizir/laravel-keycloak-web-guard#where-the-accessrefresh-tokens-and-state-are-persisted

tigran73 commented 3 years ago

Привет! Состояние - это значение, которое сохраняется для обеспечения непрерывности потока аутентификации. Убедитесь, что вы хорошо его сохраняете.

Пожалуйста, проверьте наш README: https://github.com/Vizir/laravel-keycloak-web-guard#where-the-accessrefresh-tokens-and-state-are-persisted

Hey! I solved the problem! By adding KeycloakWeb::saveState(); to src/Controllers/AuthController.php in the register method after $url = KeycloakWeb::getRegisterUrl(); line:46 .

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.