I admit this is a real basic question (I'm very new to web development), but when I try saving the contents of this OAuth sample on to my local drive, I cannot view it in my browser - the screen is blank.

I also tried replacing the appId line with the App ID of an ArcGIS Online app that I registered. The same problem persisted. This app that I registered was a generic app, following the instructions here, with the Application selection chosen for Step 3 of the Add Apps instruction set.

My company has an organizational account with secure feature layers. I want to reference these layers in web maps that would be solely located within a shared drive. From the looks of it, OAuth 2.0 is what I would need for user access, but I can't seem to make the demo work properly locally. Does anyone have any suggestions?

  • What errors are you getting? In Chrome right click on your map > Inspect Elements. In the tools window click Console (might be under >> arrows).
    – timlohnes
    Aug 3, 2015 at 15:27
  • There are the following three errors: GET file://js.arcgis.com/3.14compact/dijit/themes/claro/claro.css net::ERR_FILE_NOT_FOUND graph_test.html:114 GET file://js.arcgis.com/3.14compact/ net::ERR_FILE_NOT_FOUND graph_test.html:118 Uncaught ReferenceError: require is not defined
    – baobobs
    Aug 3, 2015 at 18:47
  • Did you download the contents of the zip file associated with that sample? There's another file in there that's crucial (oauth-callback.html) in making it work. That's not explained very well in the documentation.
    – kenbuja
    Aug 3, 2015 at 18:52
  • I did, but looks like there are some additional components needed (see John's answer).
    – baobobs
    Aug 4, 2015 at 15:54

1 Answer 1


you'll need to ensure that an appropriate redirect_uri is specified for the ArcGIS Online item associated with the clientid you are using in the app.

http://doc.arcgis.com/en/arcgis-online/share-maps/add- items.htm#ESRI_SECTION3_EA170D63DFBD419D97594A889697FCB0

this is what keeps our platform for passing along tokens associated with logged on users to malicious/unsuspected applications.

  • Thanks John. Could you please let me know what the redirect_uri should be if the app (in this case, an html file) resides in a local drive? This is what I've read: " Ideally the redirect URL should point to an HTML page that lives in the same directory as your application. Some developers want to know if they can use convention of 'localhost' in their URL. This is perfectly acceptable. " Forgive me for the noob question, but would the use of localhost infer that a web server would be required for this to work? I'm not sure where the uri should point to, and whether a web server is required.
    – baobobs
    Aug 3, 2015 at 18:52
  • the redirect_uri registered w/ ArcGIS Server needs to match whatever hostname you're accessing (over http) when you load your own page in the browser. this does not mean that you need to push your site out to a server on the world wide web, but you will have to use something like Apache/IIS/etc. for your own local development. this is a pre-requisite for our JSAPI anyway: developers.arcgis.com/javascript/jsapi/api_devenv.html Aug 3, 2015 at 19:10
  • Thank you for all your help on this, John. I'll be sure to follow up on your suggestion and get the web server up and running. I appreciate the patience.
    – baobobs
    Aug 4, 2015 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.