Remember last logged in users in Azure Active Directory Xamarin Forms

by Arslan Pervaiz   Last Updated April 17, 2019 11:26 AM

I am using Azure AD to authenticate the user in my Xamarin forms app and what I want to achieve in my UWP app that if one user lets says signed in the app and then signed out. On Next login flow Azure AD should show list of user who were logged in on that particular device so user can pick the user and just enter password.

In my case if I signout the user then it always start the flow from asking the email and password

Here is code snippet for signout

AuthenticationContext authContext = new AuthenticationContext($"{tenantUrl}/{tenantId}");

                Windows.Web.Http.Filters.HttpBaseProtocolFilter myFilter = new Windows.Web.Http.Filters.HttpBaseProtocolFilter();
                var cookieManager = myFilter.CookieManager;
                var cookieUri = new System.Uri(tenantUrl);
                HttpCookieCollection myCookieJar = cookieManager.GetCookies(cookieUri);
                foreach (HttpCookie cookie in myCookieJar)

P.S: Seems to be issue for UWP ADAL package since samething is working fine on iOS

Answers 1

With ADAL package, you won't see last logged in users email id. But if you use MSAL package by default, you will be able to see the list of last logged in users email id. I tried on my local machine and with MSAL package I am able to see the user's email id list. Below is the screenshot.

enter image description here

I hope the above information is helpful.

April 17, 2019 11:25 AM

Related Questions

Updated April 23, 2018 22:26 PM

Updated November 28, 2017 09:26 AM

Updated July 12, 2018 06:26 AM

Updated July 19, 2018 15:26 PM

Updated July 22, 2018 12:26 PM