How to exchange authorization code for token using C#?

Hello All,
I am new to Okta. I am using Authorization Code flow. I am able to send request to /authorization endpoint and retrieve the Authorization Code, but I am not sure how to send request to the token endpoint and exchange Authorization Code for a token. I am using .Net windows forms application to do it. When I tried to send request to the /token endpoint from postman, I am getting the following error “Bad request. Accept and/or Content-Type headers likely do not match supported values.”
Also, please confirm if my token url is correct. https://{DOMAIN}/oauth2/default/v1/token

My application configuration looks like this:

Can someone please guide me on this?


Hi @devhare.mangesh ,

The token URL you are using is correct. We have a guide that explains how the API call should be formatted for this endpoint. Can you confirm the “accept” and “content-type” headers in your request match what is explained in the following docs: