Created
May 29, 2013 22:20
-
-
Save phpmaps/5674308 to your computer and use it in GitHub Desktop.
OAuth workflow using ArcGIS API for JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dojo.require("esri.arcgis.Portal"); | |
dojo.require("app.OAuthHelper"); | |
dojo.ready(initialize); | |
function initialize() { | |
OAuthHelper.init({ | |
appId: "q244Lb8gDRgWQ8hM", | |
portal: "http://www.arcgis.com", | |
expiration: (14 * 24 * 60), // 2 weeks, in minutes | |
popup: false | |
}); | |
if (OAuthHelper.isSignedIn()) { | |
displayItems(); | |
} | |
else { | |
// Anonymous view | |
dojo.style(dojo.byId("anonymousPanel"), "display", "block"); | |
dojo.style(dojo.byId("personalizedPanel"), "display", "none"); | |
} | |
} | |
function signIn() { | |
OAuthHelper.signIn().then(displayItems); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment