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=htt...) 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.