Issue with getting authorization code

Log in - Asana&redirect_uri=http://localhost:8080&response_type=code&state=randomstring
I am using above uri to get authorization code. But I am getting html of asana login page when I run it in postman. I am expecting a JSON which will contain either error message or the authorization code. What mistake am I making. Help me to solve the issue.


Hi @Atharva_Anant_Diwan
That url is not used to get json data:

It’s an html page that you redirect your user to, and he accepts the conditions.

Then, he gets back to your site, with a code in the querystring.

Then, from that code, you do the next step, calling, with the correct parameters.
And you will get your tokens in json response.

I want to use it in desktop application and purpose of my application is to do automation. So is it possible to get access token only with client id and client secret.

Is your desktop app always logged as the same user, to execute some background tasks?

If yes, you can manually get your token + refresh token, and after, “hard code” your refresh token somewhere, and update it when you get the “token expired” response.
After updating your token, it is valid for about 1 hour.
But the “refresh token” should be valid for ever.

I have a main application and inside that I want to create a plugin for asana which and that plugin will help user to automate things like creating tasks, subtasks or creating stories etc. So inside that main app a single user can use a plugin multiple times with different credentials. So users are different.
That’s why I need to create access token every time and I only want JSON response. Please help me out if possible.