Enter the Application without username and password

2729
14
11-20-2019 08:40 AM
AlbertoCañivano1
New Contributor II

Good morning.
I am implementing a proxy to my application so that the user does not have to enter login/password every time he wants to enter the application.
I have the application downloaded and implemented on my local server.
I have checked that the webmap is shared with the Organization as well as the layers it has published.

I am using Xammp's Apache server and the proxy chosen was the PHP version offered by ESRI.

GitHub - Esri/resource-proxy: Proxy files for DotNet, Java and PHP. 

First I configured the proxy.config:

<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*"
             logFile="proxy_log.log"
             mustMatch="true">
    <serverUrls>
    	<serverUrl url="https://MY_ORGANIZATION.maps.arcgis.com/"  
                   username="USER"  
                   password="PASSWORD"
                   matchAll="true"/>

        <serverUrl url="http://services.arcgisonline.com"  
                   matchAll="true"/>
	
    </serverUrls>
</ProxyConfig>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Second I configured the config.json:

"wabVersion": "2.12",
  "isWebTier": false,
  "httpProxy": {
    "useProxy": true,
    "alwaysUseProxy": false,
    "url": "PHP/proxy.php?",
    "rules": [{  
        "urlPrefix": "http://MY_ORGANIZATION.maps.arcgis.com/",  
        "proxyUrl": "PHP/proxy.php?"  
    }]‍‍‍‍‍‍‍‍‍‍

The application loads correctly without asking for username/password.
However it does not load the features.

Access to XMLHttpRequest at 'https://static.arcgis.com/attribution/World_Imagery?f=json' from origin 'http://localhost' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

Access to XMLHttpRequest at 'https://services9.arcgis.com/YJdM1D4Nb7rZFsXe/arcgis/rest/services/Viviendas/FeatureServer/0?f=json' from origin 'http://localhost' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

Services that are not displayed return an error of the type:

{"error":{"code":499,"message":"Token Required","messageCode":"GWM_0003","details":["Token Required"]}}

I don't know if the mistake can come from:
1) I haven't introduced any service in the "proxy.config" so that it passes with the proxy and the features are displayed.
2) When entering username/password I have to change another parameter that I don't know what it can be.


Any idea? Thank you very much in advance

Tags (2)
0 Kudos
14 Replies
AlbertoCañivano
New Contributor III

Robert.

And do you know some way I could implement in my application in which: the user is signed in only once and that session lasts a certain time. The application I have is opened by a url in which the user makes filters and visualizes the chosen. Currently, each time you generate a new url, Arcgis Online asks for the username and password and that's what I want to avoid.
Thank you.

P.S. Sorry about the username (I am Alberto during this post), two Arcgis Online accounts have been linked and I have to configure it again.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Alberto,

   The proxy is the only route I have used. You could search GeoNet for enabling WAB with oAuth.

AlbertoCañivano
New Contributor III

I've been reading documentation and testing the oAuth protocol, but I don't think it's worth it. Thank you for your help Robert.

0 Kudos
AlbertoCañivano
New Contributor III

Robert.

Just to close the post.
Do you think it would go faster if instead of publishing the entities in different services as I have it (there are 15 features) would go faster if I only publish a service with all features?
What if I use another proxy like .Net? Could I get better performance? Right now I have PHP proxy working.
Thank you. 
P.S. I don't know how to close the post, the answer you gave me is good for me and correct.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Alberto,

Do you think it would go faster if instead of publishing the entities in different services as I have it (there are 15 features) would go faster if I only publish a service with all features?

   That could work. I have never used the php proxy so I am not sure about any speed difference.

0 Kudos