Select to view content in your preferred language

OAuthInfo JavaScript not taking me to Enterprise Login

600
1
06-23-2022 04:08 AM
JLT
by
Emerging Contributor

Trying to login to our company portal in ArcGIS Enterprise using (JavaScript 4.23), but the login takes me to ArcGIS Online. I provide the url in my JavaScript, but this still happens. Can you advise please. Thank you.


        var info = new OAuthInfo({
          appId:'oXxSEcZ4TXxuIl62',
          popup: false,
          portalUrl: 'https://test.cloud.esriuk.com'
        });
        IdentityManager.registerOAuthInfos([info]);
 
OAuthInfo.PNG
0 Kudos
1 Reply
KenBuja
MVP Esteemed Contributor

This is the code I use for testing the OAuth login and I get the proper Sign in screen.

      const portalUrl = 'my portal url';
      const info = new OAuthInfo({
        appId: "my appID", //*** Your Client ID value goes here ***//
        popup: false // inline redirects don't require any additional app configuration
      });

      identityManager.registerOAuthInfos([info]);
      identityManager.getCredential(portalUrl);
      identityManager.checkSignInStatus(portalUrl).then(function () {
        layer = new FeatureLayer({
          url: 'my unshared service url',
          outFields: ["*"]
        });
        map = new Map({
          basemap: 'oceans',
          layers: [layer]
        });

        view = new MapView({
          container: "viewDiv",
          map: map,
          center: [-153, 63],
          zoom: 4,
          popup: {
            autoOpenEnabled: false
          }
        });
      });
0 Kudos