Integrate hydra with Discourse OIDC

Hello, I am trying to integrate Discourse OIDC with Hydra. But hydra server returns invalid_grant error. Detailed informations are pasted below. Whan could possibly go wrong here?

Error:
(oidc) Authentication failure! invalid_credentials: OAuth2::Error, invalid_grant: The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client
{“error”:“invalid_grant”,“error_description”:“The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client”,“error_hint”:“The OAuth 2.0 Client is not allowed to use authorization grant “authorization_code”.”,“status_code”:400}

Client creation
docker run --rm -it
-e HYDRA_ADMIN_URL=https://$HOST:4445
oryd/hydra:v1.3.1-alpine
clients create --skip-tls-verify
–id forum-client
–secret $CLIENT_SECRET
–grant-types client_credentials
–response-types token,code,id_token
–scope openid,offline
–callbacks https://discourse.app/auth/oidc/callback
–post-logout-callbacks “https://discourse.app/logout

Client configuration

Discourse plugin: https://meta.discourse.org/t/openid-connect-authentication-plugin/103632

It was just solved by adding giving authorization_code grant to the OAuth client. :man_facepalming:

Wow pretty cool that you got this working! Would you be open to write a tutorial on how you did it and contribute that to the docs? :slight_smile: I can set up a document for you - we are trying to collect examples like these :slight_smile:

Sure thing! I am open to contribute. It was pretty straightforward.