Skip to main content
Answered

Exchange authorization code with access token

  • January 17, 2025
  • 3 replies
  • 32 views

Forum|alt.badge.img+1

Just to give some context, I’m not a developer, but I have worked with other APIs before, including OAuth 2.0.

I’ve tried to pass the client_secret, code, and redirect_uri as query params, the client_id, and client_secret as body params, and the accept and content-type headers with application/json and application/x-www-form-urlencoded, respectively.

I've also tried to do everything as body params using application/json in the content-type header and a few slight variations.
Nothing seems to work! I always receive the following message:
status: 401
code: tokenNotProvided
message: No authorization data was found on the request
type: error
By the way, I’m using Make to make the request.

Is it me or the https://developers.miro.com/reference/ne-exchange-authorization-code-with-access-token could be improved?

Best answer by Horea Porutiu

Hi ​@Brenno Vicario Nicolau 

I’ve just tried this cURL request and it worked fine. Could you please try again with cURL instead? 

curl -X POST https://api.miro.com/v1/oauth/token \
     -H "Content-Type: application/x-www-form-urlencoded" \
     -d "client_id={your-client-id}" \
     -d "client_secret={your-client-secret}" \
     -d "code={your-code}" \
     -d "redirect_uri=https://developers.miro.com/docs/" \
     -d "grant_type=authorization_code"

 

View original
Was it helpful?

Horea Porutiu
Mironeer
Forum|alt.badge.img+1

Hi ​@Brenno Vicario Nicolau 

I’ve just tried this cURL request and it worked fine. Could you please try again with cURL instead? 

curl -X POST https://api.miro.com/v1/oauth/token \
     -H "Content-Type: application/x-www-form-urlencoded" \
     -d "client_id={your-client-id}" \
     -d "client_secret={your-client-secret}" \
     -d "code={your-code}" \
     -d "redirect_uri=https://developers.miro.com/docs/" \
     -d "grant_type=authorization_code"

 


Horea Porutiu
Mironeer
Forum|alt.badge.img+1

This video may help as well. You could also try our Node OAuth app example too if you want an example implementation. 


Forum|alt.badge.img+1

Thanks, ​@Horea Porutiu! It worked perfectly.


Reply