I trying to add mechanizm to refresh access_token by passing refresh_token but unfortunately I’m getting an error:
“The refresh_token parameter was missing.”
with 400 HTTP code.
Those are steps which I’m did - can someone verify it and tell me if I did something wrong or something stopped working after recent changes Changes to API token formats ?
Obtain initial access by code exchange:
POST https://app.asana.com/-/oauth_token
?grant_type=authorization_code
&client_id=1234567890
&client_secret=client_secret_123
&redirect_uri=https://my-redirect-uri.com
&code=2/code
HTTP/1.1
Went into Postman → “Body” tab → “form-data” radio button → fill out the information for grant_type, client_id, ‘client_secret’, refresh_token, redirect_uri. Click on “Send” button and see results. EX:
NOTE: although we say redirect_uri is required in our docs I tested this without passing in a redirect_uri and the request still succeeds. I believe the required redirect_uri is meant for the POST https://app.asana.com/-/oauth_authorize request not the POST https://app.asana.com/-/oauth_token endpoint
Hi John!
thanks for your help! now I now why it’s not working
but… it’s totally misleading! in a single endpoint once you expect “x-www-form-urlencoded” for code exchange and for refreshing you expect “form-data”
also in the docs, and here you mentioning “form-encoded POST body” which isn’t specific enough… even ChatGPT would fall in to the same problem like me
me > which header I should use form-data or x-www-form-urlencoded when docs says form-encoded?
chatgpt 3.5 > If the API documentation specifies “form-encoded” without explicitly mentioning either form-data or x-www-form-urlencoded , it might be a bit ambiguous. However, in many cases, “form-encoded” refers to x-www-form-urlencoded
can you maybe at least update the docs to be more specific?
Going from what we learned above, it seems like application/x-www-form-urlencoded is sufficient on making the request.
Applying this learning to our Upload an attachment endpoint it makes sense why this endpoint requires multipart/form-data since this endpoint can take in binary data from an attachment.