How to use the checkSignInStatus

4605
3
03-09-2015 08:23 AM
EvelynHernandez
Occasional Contributor III

Hello everybody,

I want to know about how to use this function (checkSignInStatus(resUrl)) cuz the thing i want to do is , when the user log in using the identitymanager (my service layer is with security), displays a message or welcome alert with the user id like :"Welcome Ms/Mrs: <userid>"

I dont know if im in the right way or the right function. I have read the doc api and it doesnt show any example.

Im using windows authentication.

Thanks for all ur help as always.

0 Kudos
3 Replies
KenBuja
MVP Esteemed Contributor

Have you taken a look at the OAuth samples?

  OAuth Basic | ArcGIS API for JavaScript

  OAuth Popup | ArcGIS API for JavaScript

These use the checkSignInStatus to populate the div userID with the user name

esriId.checkSignInStatus(info.portalUrl).then(
      function (){
        displayItems();
      }
    ).otherwise(
      function (){
        // Anonymous view
        domStyle.set("anonymousPanel", "display", "block");
        domStyle.set("personalizedPanel", "display", "none");
      }
    );


    function displayItems(){
      new arcgisPortal.Portal("https://www.arcgis.com").signIn().then(
        function (portalUser){
          console.log("Signed in to the portal: ", portalUser);

          domAttr.set("userId", "innerHTML", portalUser.fullName);
          domStyle.set("anonymousPanel", "display", "none");
          domStyle.set("personalizedPanel", "display", "block");

          queryPortal(portalUser);
        }
      ).otherwise(
        function (error){
          console.log("Error occurred while signing in: ", error);
        }
      );
    }
0 Kudos
EvelynHernandez
Occasional Contributor III

I will try them, but the oauth function only works with a Esri user account? Cuz i want to do something similar but without using an esri account, just with a windows domain account.

Thanks for ur answer

0 Kudos
EvelynHernandez
Occasional Contributor III

I couldnt do what i want to do.

I am using a secure service layer trying accessing with a windows account, but i dont know how to get when the user id when he already logged in succefully.

If anyone can help me with a code example will be useful.

Thanks

0 Kudos