Can I Secure Web Application?

856
4
10-17-2016 06:07 AM
LianaSmith
Occasional Contributor II

I am using secured map service for one of my applications. When I open the application, the authentication window opens asking for password and user id. Is there any way I can specify the user id and password in the code for application, so it uses it automatically when the application opens?

Thanks!

0 Kudos
4 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Liana,

Are you using an application built with Web AppBuilder?  If you are, you can add the secure service to ArcGIS Online as an item.  You will be prompted for the username/password and have the option to store the username/password with the item.  See the following help document:

Add items—ArcGIS Online Help | ArcGIS 

You could also setup a proxy:

Using the proxy | Guide | ArcGIS API for JavaScript 3.18 

Here is an example of a proxy.config file with a username/password for a secure service:

<serverUrl url="http://services.arcgis.com/dlFJXQQtqUk/arcgis/rest/services/" 
     username="user1" password="gis12345" matchAll="true">
</serverUrl>     ‍‍‍
LianaSmith
Occasional Contributor II

Hi Jake,

thank you for your reply!

Yes, I am using WAB Developer Edition. I set up the proxy by adding proxy folder to my application and including server url information to proxy.config file.

Since I am doing it for the first time, I am bit confused on what I should write in the applications' config.json file.. Path to the proxy?

Now it is like that:

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Liana,

   That is where the second link in my reply helps.

0 Kudos