AnsweredAssumed Answered

Enter the Application without username and password

Question asked by alberto.canivano1 on Nov 20, 2019
Latest reply on Dec 2, 2019 by rscheitlin

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

Outcomes