How can I bypass the authorization of esri/IdentityManager?

2803
3
09-15-2014 03:34 PM
WorkPlayce
New Contributor

Using webmap template using Javascript from the Arcgis Online Webmap builder.

It throws an authentication box during testing...

How can one bypass this?

There is a function below:  of course signedIn is returned not signed in.

Where can one get the value of appId to pass into oAuthInfo?  Would passing in the appropriate value cause it to be signed in?
I have the userid/password which works on the signin form.

Can one automatically sign in programmatically...?

    _checkSignIn: function () {

            var deferred, signedIn;

            deferred = new Deferred();

            //If there's an oauth appid specified register it

            if (this.config.oauthappid) {

                var oAuthInfo = new ArcGISOAuthInfo({

                    appId: this.config.oauthappid,

                    popup: true

                });

                IdentityManager.registerOAuthInfos([oAuthInfo]);

            }

            // check sign-in status

            signedIn = IdentityManager.checkSignInStatus(this.config.sharinghost + "/sharing");

            // resolve regardless of signed in or not.

            signedIn.promise.always(function () {

                deferred.resolve();

            });

            return deferred.promise;

        },

0 Kudos
3 Replies
KellyHutchins
Esri Frequent Contributor

The Sharing Maps with Secure layers tutorial explains how to setup an app that uses secure services without requiring application end users to log-in.

Tutorials | ArcGIS API for JavaScript

0 Kudos
BrandonFlessner
Occasional Contributor

Is there a way to do app authentication without a proxy? Say, manually generate a long lived token, hard code that into the app, and use the token to access secure services. In this case I don't care if someone can see the token or other needed login information from developer tools because the app is internal. I tried appending '?token=********' to the map service url, but that failed (possibly a ip address issue in my testing environment?). Or can I programmatically login via the identity manager without displaying a dialog box? Thanks for any help you can provide! (FYI, the services are hosted on ArcGIS for Server, not AGOL)

BrandonFlessner
Occasional Contributor

Well it was an issue with the ip address and my testing environment - I'm up and running via appending the '?token=****' method.

0 Kudos