OAuth PKCE Example

I’m setting up an OAuth2 application for my Gitea Organization and I’d like to use the Proof Key for Code Exchange (PKCE) grant.

There’s a great example in the docs (https://docs.gitea.io/en-us/development/oauth2-provider/), however it explicitly says:

Note: This example does not use PKCE.

I was wondering if anyone can point me to a working example? The Authorization Endpoint seems to be working fine, but when I POST to the Access Token Endpoint it throws:

Only refresh_token or authorization_code grant type is supported

which is weird because I have grant_type=authorization_code in my request.

Any nudge in the right direction is appreciated, thank you!