GitHub OAuth with OpenAPI

I’m working on creating a prototype for FastAPI’s documentation to use OpenAPI authorization_code with GitHub. The redirect and user auth works but retrieving the access token fails.

My OAuth App is configured with the following:
Homepage URL: http://localhost:3001

Authorization callback URL: http://localhost:3001/docs/oauth2-redirect

Client is configured as such:

authorization_url: https://github.com/login/oauth/authorize
token_url: https://github.com/login/oauth/access_token

CLI messages:

INFO: 127.0.0.1:51022 - “GET /docs HTTP/1.1” 200 OK
INFO: 127.0.0.1:51022 - “GET /openapi.json HTTP/1.1” 200 OK
INFO: 127.0.0.1:51027 - “GET /docs/oauth2-redirect?code=2ff5cadff69b45f6ffe9&state=VHVlIEphbiAxNCAyMDIwIDIzOjQzOjM1IEdNVC0wNTAwIChFYXN0ZXJuIFN0YW5kYXJkIFRpbWUp HTTP/1.1” 200 OK

UI error:
auth error TypeError: NetworkError when attempting to fetch resource.

After successfully authenticating the redirect throws a 404 error. I know this is really a 403 error that GitHub obfuscates with a not found error instead.

I need to find out if this is configuration related or incompatibility with GitHub and OpenAPI. (Already tested against KeyCloak and Google)

Any ideas?