storymap-journal icon indicating copy to clipboard operation
storymap-journal copied to clipboard

changes to how to use proxies in this release?

Open upcamogie opened this issue 7 years ago • 4 comments

I have a map journal app using the 1.6.1 template and its still find except the navigation to certain pages/home does not work when viewed with my custom URL (although strangely it works when i edit the map journal on AGOL). So I downloaded this version of the template and did the same proxy steps (adding in config.js and index.html the proxy rules code I was given previously) and the app is still asking for credentials for the AGOL log in and the secure service. I then tried to use my Oauth appID I created for my other apps that is also in my proxy page without changing anything except the reference to my proxy in the config.js and I get an invalid redirect_uri

Is there still a way to use my proxy rules code in the index.html that seemed to work better than the OauthID? I'd like to use the new template for any added/improved functionality but tweaking my proxy settings each time is getting exhausting. thanks for any insight on where to go from here

upcamogie avatar Dec 29 '16 17:12 upcamogie

Hmm, sorry you're having an issue with this. We tested the proxy and it seemed to work as expected using the steps below. If these aren't working I'd suggest please contacting Esri Support as they'll be better able to help you troubleshoot your specific issue.

  1. registered this layer in My Content, and used "ask for credentials" option https://sampleserver6.arcgisonline.com/arcgis/rest/services/SaveTheBay/FeatureServer/0 (user1/user1)
  2. added that layer to a map
  3. added that map to a Map Journal
  4. downloaded Map Journal 1.9.1 from github
  5. added the appid to index.html
  6. because the app is private, added localhost/ app as an app item in My Content, and registered it for OAuth use
  7. added OAuth appid to index.html
  8. in app/config.js, added a proxy rule under PROXY_RULES for sampleserver6 and the installed proxy
  9. in proxy/proxy.config, added user1/user1 for sampleserver6

oevans avatar Dec 30 '16 19:12 oevans

Thanks for the response, Owen. In the past I have not had to register my layer (secure service) in My Content because I would reference the URL in the proxy rules- is this now required? I got my proxy working with my usual private map, app and secure service but I would like to employ the oauth as you recommend as long as there are no log ins required anywhere. Do I have to create a new app content item every time I want to access private maps/apps or can I reuse my one I have already that works for other apps? My initial support call was resolved for the actual proxy rules, but with which team would I follow up with for figuring out the above workflow using the Oauth instead of adding lines of code? thanks

upcamogie avatar Jan 04 '17 19:01 upcamogie

@oevans,

I am working with @upcamogie in the support case. We have webmap in ArcGIS Online that is only shared with organization and few secured layers in local ArcGIS Server. @upcamogie wants to have no login popup at all.

So we helped her configure the resource-proxy and added PROXY_RULES to the webmap URL and the secured layer URL. And this is working now, no login pop up.

The questions are

  • Is this a correct workflow? (by adding PROXY RULES to webmap URL and secured layer URL)
  • Should we use OAuth2 authentication by adding "oAuthAppId" in index.html file? In my understanding, it will have an login pop-up window to AGOL as part of the OAuth2 workflow. @upcamogie does not want to have any login whatsoever to the end user, since this application is meant to be used for general public.

Thank you.

esoekianto avatar Jan 05 '17 18:01 esoekianto

Hi @upcamogie, sorry, I think we misunderstood your initial question. After talking to @esoekianto, it sounds like, in version 1.6.1, users used to be able to list the PROXY_RULES in index.html, but in 1.9.1, this no longer works.

That is correct. You should now list your PROXY_RULES in the file app/config.js.

There is no need for OAuth2 authentication at this point, and you are correct that adding it would trigger the login window that you are avoiding with your proxy.

Technical info: in 1.9.0, we changed the way we're loading scripts (from document.write() to creating a script element and inserting it into the page, because Chrome is deprecating its support for document.write on slow internet connections; see here). This change causes the esri object, which is what sets the proxy rules, to be available to the app slightly later than in previous versions. So with the new script loading and timing, the place in index.html where you were listing your PROXY_RULES was happening before the necessary scripts were available to set those rules.

Thanks! Hope this helps!

asizer avatar Jan 06 '17 21:01 asizer