Asana App "client_id" not valid for initiating OAuth2?

The client_id of my created Asana app seems to be invalid:

I’m following the OAuth (OAuth) documentation for implementing OAuth code grant flow.

In developer console i:

  1. Created the Asana app
  2. Clicked the OAuth tab
  3. Copied the client_id
  4. Registered my redirect uri which i tested and is reachable.
  5. Created the link for initiating the OAuth flow like this:

https://app.asana.com/-/oauth_authorize
?client_id=XXXXXXXXX
&redirect_uri=https://localhost:XXXX/asana/GetAccessToken
&response_type=code
&state=thisIsARandomString
&code_challenge_method=S256
&code_challenge=671608a33392cee13585063953a86d396dffd15222d83ef958f43a2804ac7fb2
&scope=default

I always get the error on the browser:

invalid_request: The required parameter client_id is missing or invalid.

It is the same client_id that is on my newly created app and it seems to be invalid. I validated in the browser that a GET request is sent to this URL i wrote up here and the 'client_id parameter is being sent.

What could be the possible mistake here?

1 Like

Hi @Alex150,

Can you try copying the OAuth URL from your developer console and pasting it into a web browser and seeing if you get any errors?

If the above works than perhaps you want to check this URL against the part of your code that constructs the OAuth URL to see if the proper client_id is being used and if it is there is any missing information.

Here’s our example OAuth app and this is where we are constructing the OAuth URL.

Hello John!
Thanks for your response!

Yes i’ve tried the URL that my developer console generated when i inputted a valid redirect URL, pasted it in the browser and got the same error: invalid_request: The required parameter client_id is missing or invalid.

The URL generated in the console API is:
Log in - Asana<STATE_PARAM>

I noticed it URL encodes the URL, i’ve tried it URL encoded and unencoded and get the same response (the endpoint is reachable). It’s like the client id was invalid from the start.

I don’t know what else i can try here.

Forgot to mention that maybe the URL was not reachable so i also tried tunneling with ngrok, does not seem to be the case, still get the same invalid client_id error.

Hi @Alex150,

I believe this is happening because of our new app distribution feature. By default new apps created will have “Specific workspaces” selected. You will need to add your workspace or select “Any workspace” to get the OAuth flow to work.

Let me know if this fixes your issue.

4 Likes

That did it!
Since it was in the distribution tab i did not think it was of use at the moment (or related to client_id itself). Also didn’t see it on the OAuth documentation.

Thank you for your time John!

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.