OIDC Callback Error – 401 Unauthorized while handling authorization code

0
Hi, I am integrating OIDC in my Mendix application and facing an issue during the callback process. When the authorization code is returned and the microflow tries to call the token endpoint (REST POST), I am consistently getting the following error:   latestError:Message - 401: Unauthorized    at OIDC.handleAuthorizationCode (CallRest : 'Call REST (POST)')    at OIDC.webCallback (SubMicroflow : 'handleAuthorizationCode') Advanced stacktrace:Error calling REST service    at OIDC.handleAuthorizationCode (CallRest : 'Call REST (POST)')    at OIDC.webCallback (SubMicroflow : 'handleAuthorizationCode') Caused by:401: UnauthorizedContent - {"error":"access_denied","error_description":"Unauthorized"}   The callback URL is configured correctly in my IdP, and I am passing the client ID/secret in the request. Still, the token request is failing with 401 Unauthorized. Has anyone else faced this issue? Am I missing any configuration (like headers, token endpoint settings, or redirect URL mismatch)? Any guidance would be appreciated. Thanks in advance!    
asked
1 answers
0

Make Sure to Follow this steps to resolve your Issue 

  • Use POST to the IdP token endpoint.

  • Add header → Authorization: Basic base64(client_id:client_secret).

  • Add header → Content-Type: application/x-www-form-urlencoded.

  • Body → grant_type=authorization_code.

  • Body → code=<authorization_code>.

  • Body → redirect_uri=<exact_registered_redirect_uri>.

  • Check client_id and client_secret are correct.

answered