A detailed guide about creating the ADAL Xamarin binding for Android

Today I just put together a step by step guidance to get Azure Active Directory Authentication Library to work on a Xamarin Android project: https://www.matvelloso.com/2014/07/02/adal-bindings-xamarin-android-applications-ultimate-guide/

Comments

  • Anonymous
    February 09, 2015
    Great work!!!! Do you also have any reference to connect to ADFS using Xamarin Shared apps???

  • Anonymous
    April 03, 2015
    Hi Nikhil, As far as I know, whether you are using ADFS or AAD, it shouldn't matter. In other words, the inherent library (ADAL) and protocols should take care of that.

  • Anonymous
    September 22, 2015
    Hi Mat, This is great help, however when I run this for ADFS: I get a webview ( i believe) Which has the app icon on top left, Title 'Authentication' and a cancel button at the bottom. However it doesnt ask for username and password or a submit button? Sorry I am very new to ADFS and Xamarin Android.

  • Anonymous
    September 23, 2015
    Kushal, It's hard to tell without the details but I would assume that the browser in the mobile app is being unable to load the page from ADFS. This could either be a network issue, an app manifest issue or an authentication problem. Putting some network monitoring in the middle might help telling where the problem actually is.

  • Anonymous
    September 23, 2015
    Hi Mat, It turns out if I refresh the authentication page I am displayed with the inputs however when i click inside username the screen goes blank. And If i refresh the screen by changing the orientation of the samsung device. It renders the page again. Not sure if you have come across this issue. I have made sure that I have followed your tutorial through out yet no success on my end. My Manifest:  <uses-permission android:name="android.permission.INTERNET" />  <uses-permission android:name="android.permission.NFC" />  <uses-permission android:name="android.permission.VIBRATE" />  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />  <uses-permission android:name="android.permission.GET_ACCOUNTS" />  <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />  <uses-permission android:name="android.permission.USE_CREDENTIALS" /> <application android:label="BReadyAndroid" android:icon="@drawable/Icon"&gt;    <activity android:name="com.microsoft.adal.AuthenticationActivity" android:label="Authenticate"></activity> </application> The browser settings are default as this is a brand new phone. I am really running out of ideas been searching every where. I have tested on three different devices Samsung S5 OS 5.0.0, Samsung XCover 3 OS 4.4.4, HTC OS 4.2.3. Always the same issue. If i click on a link inside the ADFS login screen it redirects to microsoft login screen and then the inputs work fine. The issue seems to be around that page. I am not sure if its Javascript on the page affecting this behaviour.

  • Anonymous
    September 23, 2015
    Also is it possible to AcquireTokenSIient? This may remove this issue I am having? Thanks.

  • Anonymous
    September 24, 2015
    Kushal, any chance you could try with ADAL v3 for Xamarin? It should simplify the work there. Also, was there any customization of the ADFS login screen done? Acquiring token without a login from a mobile device isn't a good idea, it would expose too much of your security.