How to authenticate with localhost?

api

#1

I’m new to any programming with Asana (I’m actually interfacing with a developer) and we’re wondering how to authenticate with Asana when developing in a localhost environment. There isn’t a way to add URLs to the developer app area.

Do we need to create a separate developer app? Something else we’re missing?


#2

I suggest you create a separate app for development.

When creating the app (and inside the code) you choose the callback the user is sent to after a sign in. This callback will be like asanatraining.com/auth-success for example. Then on your local computer you edit the host file (/etc/hosts on Linux-like systems), saying that any reference to asanatraining.com has to point to 127.0.0.1 (don’t forget to comment the line after you are done coding if you want to interact with the code in production). Then your local webserver needs to have a virtual host that responds to this domain name and redirects to your file locally.

I can provide further details if needed.


#3

I think that now Asana requires a callback URL to be HTTPS. Then things get a little tricky because you need to setup the server to have an HTTPS in local. I can provide all the code for an Apache server.


#4

Asana requires all callback URLs to be https with only two exceptions: the “Out of band” url of urn:ietf:wg:oauth:2.0:oob for command-line OAuth apps, and any url starting with the string http://localhost so you should be able to create a development app that tests against localhost :slight_smile:


#5

Awesome, great to know. Thanks @Matt_Bramlage and @Bastien_Siebman!