kotlin-multiplatform-oidc
kotlin-multiplatform-oidc copied to clipboard
Keycloak integration returns illegal input
Hi; I've been integrating keycloak in my multiplatform project and I'm encountering the following error (see logging) response when the refresh token seems to be either revoked or expired. The response from my keycloak server isn't able to be parsed. Is it as simple as adding the "invalid_grant" error to the Error enum (I'll try to create a PR) or is it a more deeper problem / wrong configuration by me?
REQUEST: https://{{keycloak-server-url}}/realms/{{realm}}/protocol/openid-connect/token
METHOD: HttpMethod(value=POST)
COMMON HEADERS
-> Accept: application/json
-> Accept-Charset: UTF-8
CONTENT HEADERS
-> Content-Length: 864
-> Content-Type: application/x-www-form-urlencoded; charset=UTF-8
BODY Content-Type: application/x-www-form-urlencoded; charset=UTF-8
BODY START
grant_type=refresh_token&client_id={{realm}}&refresh_token={{refreshtoken}}&scope=profile+email+debug
BODY END
RESPONSE: 400
METHOD: HttpMethod(value=POST)
FROM: https://{{keycloak-server-url}}/realms/{{realm}}/protocol/openid-connect/token
COMMON HEADERS
-> cache-control: no-store
-> content-length: 67
-> content-type: application/json
-> date: Sun, 14 Jul 2024 17:01:37 GMT
-> pragma: no-cache
-> referrer-policy: no-referrer
-> server: nginx/1.27.0
-> strict-transport-security: max-age=31536000; includeSubDomains
-> x-content-type-options: nosniff
-> x-frame-options: SAMEORIGIN
-> x-xss-protection: 1; mode=block
BODY Content-Type: application/json
BODY START
{"error":"invalid_grant","error_description":"Token is not active"}
BODY END
RESPONSE https://{{keycloak-server-url}}/realms/{{realm}}/protocol/openid-connect/token failed with exception: io.ktor.serialization.JsonConvertException: Illegal input: org.publicvalue.multiplatform.oidc.types.remote.ErrorResponse.Error does not contain element with name 'invalid_grant' at path $.error