Sample JavaScript Example Querying an ArcGIS Organization

437
4
Jump to solution
06-08-2022 01:46 PM
Heena1
by
New Contributor III

Hello,

I tried using Querying an ArcGIS Organization Javascript Sample which is available on Survey123 Connect. It automatically populates the user info with the currently signed in. It pulls all user info (username, first name, last name, email) when I sign into ArcGIS Online. However, it only pulls username not the rest when I log into our portal. We use IWA to portal. When I click to show JSON object, it shows Invalid username. See attached image.

Can you assist me how I can make this to work?

Heena

0 Kudos
1 Solution

Accepted Solutions
Heena1
by
New Contributor III

It worked after turning on anonymous access to IIS. Thank you for your assistance Zach!

Heena

View solution in original post

0 Kudos
4 Replies
ZacharySutherby
Esri Regular Contributor

Hello @Heena1

All the JavaScript function is doing is sending a request to the following resource: 

https://<Web context URL>/sharing/rest/community/users/<username>?f=json&token=<valid access token> 

If you test sending the same request from your browser do you see the same error? 

Thank you,
Zach
0 Kudos
Heena1
by
New Contributor III

Hi Zach,

Sending the same request from browser doesn't give the same error. See attached. 

Thank you for helping! 

Zach 

0 Kudos
ZacharySutherby
Esri Regular Contributor

Hello @Heena1

That's strange the same REST request worked in the browser, let's schedule a call to hop on a screen share and take a look at the behavior. There's a tool we can use to see exactly what's happening when Survey123 sends the request. 

Please feel free to email me at ZSutherby@esri.com and we can schedule a time that works best. 

Thank you,
Zach
0 Kudos
Heena1
by
New Contributor III

It worked after turning on anonymous access to IIS. Thank you for your assistance Zach!

Heena

0 Kudos