How To: Embed credentials into a routing service for public usage in the Directions widget
Some organizations require field personnel to access a routing service via the Directions widget while in the field. As these are not named users, they are unable to provide login credentials, which the routing service requires. For more information on named users, refer to ArcGIS Help: Named user.
The following workflow helps embed credentials in a routing service for use with the Directions widget, which allows non-named users to access the service without being prompted for login credentials. This workflow includes adding the URL for the organization and the application to the Limit Usage section of the routing service.
Log in to ArcGIS Online, and navigate to My Content > Add Item > From Web.
In the Item from the Web dialog box, ensure the following sections are defined:
Type : <select ArcGIS Server web service>
URL : <insert the routing service URL> NOTE: When prompted, insert username and password.
Title : <insert Title here>
Tags : <insert Tags here>
Click Add Item. ArcGIS Online redirects the page to the Item Details page for the new Network Analysis service.
Share the service publicly.
On the Overview tab, click Copy below the URL heading.
This URL is required for the Directions widget.
Open the application containing the Directions widget, navigate to the Widget tab, and select and remove the current Directions widget.
When prompted, click OK.
Create a new Directions widget in the application. In the Configure Directions dialog, ensure the following sections are defined:
Route URL : <insert the URL copied in Step 5>
The remaining sections can be defined as required.
Click OK and save the changes made to the application.
Copy the URL for the application.
Navigate to My Content > Item Details of the Network Analysis service > Settings > Limit Usage.
Paste the application URL copied in Step 7 in the Referrer URL or IP section, and click Add.
Add the home URL. An example is as follows:
<organization short URL>.maps.arcgis.com
Click Add > OK. This allows the application to utilize the routing service with the preset credentials.
If the service is made public, all users accessing the routing service can access the features and functions of the application. This includes features and functions that cost credits.