Problem Description
I am getting below error in moodle integration with keycloak using OpenId
Unknown state.
More information about this error
Debug info:
Error code: errorauthunknownstate
Stack trace:
line 287 of /auth/oidc/classes/loginflow/authcode.php: moodle_exception thrown
line 133 of /auth/oidc/classes/loginflow/authcode.php: call to auth_oidc\loginflow\authcode->handleauthresponse()
line 168 of /auth/oidc/auth.php: call to auth_oidc\loginflow\authcode->handleredirect()
line 31 of /auth/oidc/index.php: call to auth_plugin_oidc->handleredirect()
Output buffer: Array ( [state] => rhcy8XXhwoOtCkZ [code] => 5b74206b-8bce-474f-bfbb-b82193a61c5a.80b7565c-17e5-4725-8204-c9e9cf826fcf.7474b906-61ec-4d54-a984-acf4672bcde3 [error_description] => )
I got this when am trying to solve this error.
In an authorisation flow, you have two steps. First you receive an auth code and then you use the auth code to obtain access tokens. When you receive a response at the redirect URL, there must be a way to verify that the response came for a request which you sent. The state value solves this issue by binding request and response. It is the client which should validate the response.
In my case 'state' is being saved in database in oidcclient.php. but from /auth/oidc/classes/loginflow/authcode.php file i am getting different value of 'state'.
What can be the issue. Can anyone help in this regard.
Thanks in advance
AI-Generated Solution
Powered by LMSouq AI · GPT-4.1-mini
Analyzing problem and generating solution…
Was this solution helpful?