1

I'm integrating Asana OAuth2 using https://packagist.org/packages/ajimix/asana-api-php-class

When I set up my app on Asana and use an internal url, such as https://intranet, my redirect always fails with

invalid_request: The `redirect_uri` parameter does not match a valid url for the application

However, when I use any public url such as https://www.domainname.com it works. I can then append the code parameter to my internal page.

Is there any way to use an internal url, ie. one that is not on public DNS?

jdog
  • 2,465
  • 6
  • 40
  • 74

1 Answers1

1

I'm a Developer Advocate for Asana. Intuitively, I didn't think you should be having any difficulty accessing the redirect simply because it's a redirect - we don't try to access the URL at all, but rather tell your browser to redirect to that URL containing the authorization to access Asana. If your browser can go to that url when you browse, your browser can go to that url when instructed to with a redirect, right? So I looked into it just in case.

That particular error code is sent back when we compare the redirect url you provide for your OAuth app to the one that you registered when you generated the app - i.e. your credentials are compared to a whitelist of locations (of length 1, but what's a single whitelist? A whitevalue?) that is OK to redirect to. If your URL is not that value when you try to auth, we return that error, and it doesn't look like that particular error is involved in deeper error checking (we don't try to ping your redirect location).

I think what may be happening here is that you've registered your OAuth app on Asana as redirecting to a particular URL, and when you're pinging the https://app.asana.com/-/oauth_authorize endpoint, you're passing a different URL in the redirect_uri param. Since it doesn't match the one for which you registered your app, we send back that error. (This is what we mean when we say "The URI to redirect to on success or error. This must match the Redirect URL specified in the application settings." when describing the OAuth workflow here.

If this is the case, you can either change the redirect URL for your app, or register a new OAuth app that uses the intranet URL and use that credential to authorize with Asana.

I hope this is the root cause, but if that doesn't seem to be the case (if the URL registered with Asana and you are indeed passing the same one while trying to authorize) be sure to let us know and I'll dive deeper!

-Matt

Matt
  • 10,434
  • 1
  • 36
  • 45
  • Hi, have checked the urls are the same and it doesn't seem to be the root cause. Can I pass the app ID to some sort of support system? – jdog Nov 01 '16 at 23:22
  • Sure! A good route to go would be to send an email to api-support@asana.com with IDs and other somewhat sensitive information (like oauth app ids, and if you've sanitized URLs for this post those too, though not passwords and the like) - you can mention that you've done this much so far so that our userops guys don't start troubleshooting from scratch. Feel free to tell them that I (Matt) took the first crack at it and they'll pass it on. I'm at a conference until Tuesday, but I'll try to take a look at it when I get back. – Matt Nov 03 '16 at 00:22