Select to view content in your preferred language

ArcGIS credential dialog pops up occasionally on loading AGSSyncTask...

3102
16
Jump to solution
10-04-2021 09:10 PM
ShiminCai
Frequent Contributor

Hi there,

I'm loading layers in a feature service to map using AGSGeodatabaseSyncTask. The feature service is not secured. Everything works just fine but occasionally not always though, the ArcGIS credential dialog appears on loading the syncTask as shown in the attached image. Once the dialog is out I can't skip or sign in as the sign in button is greyed out. The only way out is to kill the app...

 

let gdbSyncTask = AGSGeodatabaseSyncTask(url: url)

gdbSyncTask.load { (error) -> Void in

    ... loading layers to the map after gdbSyncTask loaded without error...

}

 

I tried to set the gdbSyncTask.credential property with a valid credential of username and password but the dialog still pops up randomly. How can I stop it popping up?

Thanks,

 Shimin

 

0 Kudos
16 Replies
NimeshJarecha
Esri Regular Contributor

Hi Shimin,

Please add following code at the start of  `viewDidLoad` which will create a log file with all request and responses. Once, you are able to reproduce the issue, upload the generated log file at the location I gave earlier. 

 

        let config = AGSRequestConfiguration.global()

        config.debugLogFileURL = URL(fileURLWithPath: "path/to/Log.md")

        config.debugLogDeleteBeforeEachRun = true

        config.debugLogRequests = true

        config.debugLogIncludeRequestHeaders = true

        config.debugLogResponses = true

        config.debugLogIncludeResponseHeaders = true

        config.debugLogResponseTrimThreshold = 2000

 

Thank you!

Regards,

Nimesh

0 Kudos
ShiminCai
Frequent Contributor

Hi Nimesh,

Have uploaded the Log.md file.

Many thanks for your help!

Regards,

Shimin 

0 Kudos
NimeshJarecha
Esri Regular Contributor

Hi Shimin,

 

Thanks for the log. I realized that the log did not capture the response for the request which produces the error as it did not finish. Can you please reproduce the issue and when dialog pops up, hit skip on it? When done, check which request returned with `403 - Request Forbidden` error? If you don't see the error, I would suggest using any third party app to log request response. May be a Charls Proxy or Fiddler etc. 

 

Regards,

Nimesh

0 Kudos
ShiminCai
Frequent Contributor

Hi Nimesh,

Uploaded a new Log1.md file. As instructed, I hit the Skip five times and each time the dialog disappeared and came back very quickly. Checked the log file and there are a few 403 Request Forbidden errors.

Thank you very much for your help.

Regards,

Shimin

0 Kudos
NimeshJarecha
Esri Regular Contributor

Hi Shimin,

 

Thank you for the new log file. I analyzed the log file and particularly the HTTP responses and response headers. Based on that looks like your server setup has load balancer. The responses with response header Server = "" are working fine and responses which has Server = "awselb/2.0" are responding the HTTP status code 403. The response code 403 is considered as an authentication error and we prompt for the credential. You will have to figure out why that server responds with HTTP status code 403.

 

Regards,

Nimesh

0 Kudos
ShiminCai
Frequent Contributor

Hi Nimesh,

I forwarded your finding to our server people who are investigating. I'll report back how we go... Thank you so much for your help.

Cheers,

Shimin

0 Kudos
ShiminCai
Frequent Contributor

Hi Nimesh,

Our service people eventually figured out that The AWS Appplication load balancer throws a 403 if the WAF blocks something. The WAF is blocking due to the number of requests. Increasing the http request limit from 1000 to 5000 http requests from a single IP in 5 min period seemed to have stopped the credential box popping up. Thank you so much for your help.

Cheers,

Shimin