Answered by:
Xamarin.Forms Azure AAD Login Page Looses Entered User Name on Device Orientation

Question
-
User277909 posted
I have Xamarin.Forms application that authenticates user against Azure AAD. That all works fine but on Android, device orientation looses user name on the Microsoft authentication screen.
Here I am in Portrait mode and I have entered user name
I click on Next and land on screen to enter password. If I now rotate device before entering password and clicking Sign In, I am pushed back to screen asking for user name again and the user name I entered before is lost:
This is not happening on IOS devices, only Android.
How do I prevent this from going back to user name screen on Android? My MainActivity has already ConfigChages.Orientation attribute like below:
[Activity(Name = "my.mainactivity" , Label = "MyApp" , Icon = "@drawable/icon" , ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.SmallestScreenSize | ConfigChanges.ScreenLayout | ConfigChanges.Orientation)] public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity { ... }
Friday, June 28, 2019 9:20 PM
Answers
-
User277909 posted
@jennyf19 Thank you so much for looking into this. I finally was able to resolve this stubborn issue on Android.
What I had to do: 1. Update ADAL from 3.19.8 to 5.2.0 2. Then modified AuthorityURL passed to AuthenticationContext c-tor from something like https://login.microsoftonline.com/my-tenant-id/oauth2/authorize to https://login.microsoftonline.com/my-tenant-id
After this, I was able to authenticate just like before but rotation on Android would not loose already provided user id and/or password.
- Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
Friday, August 23, 2019 11:51 PM
All replies
-
User277909 posted
Above, I am using ADAL and
Microsoft.IdentityModel.Clients.ActiveDirectory
nugetTuesday, July 2, 2019 11:27 PM -
User301957 posted
@dinob We are aware of the issue. You can follow progress here in GitHub
Wednesday, July 3, 2019 11:42 PM -
User277909 posted
@jennyf19 said: @dinob We are aware of the issue. You can follow progress here in GitHub
Thank you @jennyf19
github tickets for both ADAL and MSAL here:
https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/issues/1622
Thursday, July 4, 2019 3:35 PM -
User277909 posted
@dinob said:
@jennyf19 said: @dinob We are aware of the issue. You can follow progress here in GitHub
Thank you @jennyf19
github tickets for both ADAL and MSAL here:
https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/issues/1622
@jennyf19 It is disappointing that you decided not to fix this very annoying issue. We are in mobile world now, desktops are past.
Wednesday, August 7, 2019 7:22 PM -
User277909 posted
new update, the fix is supposed to come out this week in ADAL 5.1.1 hot fix
Thursday, August 8, 2019 4:05 PM -
User301957 posted
@dinob Thanks for your patience. We had other work going on and this just got pushed behind a little. Sorry for the wait. The fix has been included in ADAL 5.1.1, and same fix will be in the next release of MSAL (4.3.1 most likely). Thanks for reporting this.
Thursday, August 8, 2019 7:24 PM -
User277909 posted
@jennyf19 Thank you so much for looking into this. I finally was able to resolve this stubborn issue on Android.
What I had to do: 1. Update ADAL from 3.19.8 to 5.2.0 2. Then modified AuthorityURL passed to AuthenticationContext c-tor from something like https://login.microsoftonline.com/my-tenant-id/oauth2/authorize to https://login.microsoftonline.com/my-tenant-id
After this, I was able to authenticate just like before but rotation on Android would not loose already provided user id and/or password.
- Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
Friday, August 23, 2019 11:51 PM