pythongis

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 (http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Network/ESRI_DriveTime_US/GPServer) 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 (http://resources.arcgis.com/en/help/arcgis-online-network-analysis-rest-api/#/Service_Area_Service_with_Synchronous_Execution/02s500000004000000/) 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 (https://www.arcgis.com/sharing/generateToken?username=yourUserName&password=yourPassword&referer=http://myserver/mywebapp&expiration=15&f=json) 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.

Outcomes