First, thanks to Peter Gamberg on the State and Local Government Team for helping me by updating the steps in the workflow. It has been several years since I wrote this and I knew the workflow had changed based on updates made to the Esri Developers site but my priorities have been elsewhere.
As you build more and more ArcGIS Online web applications for your organization, you'll likely need to include one of Esri's Premium Services, such as Live Traffic, especially if your organization is a State Department of Transportation. While Live Traffic does not cost credits, it does require a named user to access the premium content. You, of course, know this because when you launched the application, which you tirelessly spent all that time configuring, you hit the snag where the app requires the user to sign in. So how are you supposed to deploy a public app with traffic cameras, weather, and live traffic if your app requires a login?
You could provide an access token and embed it in your application, but this requires custom development, and you must host the application yourself. Also, this method creates a security risk because your token could be hijacked and used without you ever knowing.
A more straightforward solution is to create a proxy service configuration for the premium service of your choice. A proxy service allows you to encode and manage your credentials inside a service URL. Additionally, proxy services support rate-limiting. Proxy services allow you to make the Esri World Geocoding Service available to an end-user for batch Geocoding or other operations which do consume credits. However, it protects you because you can specify the rate at which addresses can be batch geocoded, preventing runaway usage while allowing the public the access they need.
Here is how it works.
- Log in to developers.arcgis.com with your ArcGIS Online credentials
- Register your application by choosing New Application
- Provide the Application Details
- Click on the Services Tab
- Scroll down to the Service Proxies area.
- Select the service you wish to proxy and enter a rate limit for the number of requests you want to allow over a given period.
- Copy the newly created proxy URL and add it to the webmap that your application is consuming. Remove the original service if it exists and save the webmap.
- Log out of all web sessions using your ArcGIS Online credentials or use Incognito Mode on your browser to test that your app opens without challenging you for credentials. (This is a quick trick to allow you to open the browser with a cleared browser cache.)
- Open your web application and bask in the glory of your app opening with Premium Services that don't prompt your public users for an ArcGIS Online Username and Password.
Try it live
Besides Traffic and Batch Geocoding you can also proxy the following services: