Calculate drive time polygons using ArcGIS Online and ArcGIS JavaScript API

Discussion created by pythongis on May 2, 2013
Our office wishes to create a public web map (using the JavaScript API) that allows users to determine drive time polygons from a given location.  The free ESRI service ( only allows a user to calculate 15 minute drive time polygons.  Our office has an ArcGIS Online account, so I want to use the Network Analysis Services and the Service Area Service ( to create these polygons.

However, I am not sure how to generate a token for the application so we can use the Network Analysis Services.  End users should not be required to enter the credentials. Instead, the credentials should be stored on the server so a token can be generated automatically for each user that visits the web map.

I have tried requesting a token in my browser with this URL ( and my ArcGIS Online credentials, but the returned JSON response says �??Invalid username or password�?�. 
What am I doing wrong and how can I generate a token so I can use the Network Analysis Services available through ArcGIS online?  Any help would be greatly appreciated.

Thank you.