Answered by:
Facing problem in using ADAL in Windows Store Application

Question
-
Hi,
I'm trying to implement ADAL SSO for my Windows Store App. I trying for both Windows 8.1 and Window 10 store App. I've been referring to following URL for connecting to my Azure Active Directory
public login() { this.InitializeComponent(); redirectURI = Windows.Security.Authentication.Web.WebAuthenticationBroker.
GetCurrentApplicationCallbackUri(); authContext = new AuthenticationContext(authority); } protected override void OnNavigatedTo(NavigationEventArgs e) { // When the app starts, fetch the user's To Do list from the service. GetTodoList(); } private async void GetTodoList() { AuthenticationResult result = await authContext.AcquireTokenAsync("https://graph.windows.net", "e11a0451-ac9d-4c89-afd8-d2fa3322ef68", new Uri("http://li")); if (result.Status != AuthenticationStatus.Success) { if (result.Error == "authentication_canceled") { // The user cancelled the sign-in, no need to display a message. } else { MessageDialog dialog = new MessageDialog(string.Format("If the error continues, please contact your administrator.\n\nError: {0}\n\nError Description:\n\n{1} {2}", result.Error, result.ErrorDescription, s1), "Sorry, an error occurred while signing you in."); await dialog.ShowAsync(); } return; } }
I replaced clientID, authority and resource url according to my project. when I run Application from Windows phone , it works perfectly. When I run the same code in Windows 10 and same logic ported in windows 8.1 , Application prompts for user id and password,I enter those, these credentials needs to be checked with Azure Active Directory but I'm getting following error
"We can't connect to the service you need right now. Check your network connection or try this again later"
I see in the output windows of Visual Studio 2015 while running application as below.
"The type 'Page' is defined in an assembly that is not referenced. You must add a
reference to assembly 'Windows.Foundation.UniversalApiContract,
Version=1.0.0.0, Culture=neutral, PubThe type 'IUICommand' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'licKeyToken=null,
ContentType=WindowsRuntime'. "I also tried to test same windows store on Windows 8.1, even their also it fails to authenticate User.
I have added all the capabilities like internet and intertclientserver etc
- Edited by MahenderMicrosoft employee Sunday, April 12, 2015 12:23 AM
Saturday, April 11, 2015 11:33 PM
Answers
-
Issue has been resolved.
In case if you are in corp network and connecting to your Azure Active Directory. we need to make use of AuthenticationContext.UseCorporateNetwork=true and SharedCertificate capability enabled on appmanifest.
- Marked as answer by Jamles HezModerator Tuesday, April 21, 2015 5:33 AM
Monday, April 13, 2015 8:15 PM
All replies
-
Hi,
Do you use the stable release of Active Directory Authentication Library (ADAL) on NuGet?
There's a sample project on https://github.com/azureadsamples/nativeclient-windowsstore that you could benefit from.
Monday, April 13, 2015 10:23 AM -
Yes. I do use stable buildMonday, April 13, 2015 3:22 PM
-
Issue has been resolved.
In case if you are in corp network and connecting to your Azure Active Directory. we need to make use of AuthenticationContext.UseCorporateNetwork=true and SharedCertificate capability enabled on appmanifest.
- Marked as answer by Jamles HezModerator Tuesday, April 21, 2015 5:33 AM
Monday, April 13, 2015 8:15 PM