question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: We can't connect to the service you need right now. Check your network connection or try this again later

See original GitHub issue

Hello all,

I have been trying to get this example to work. First Android, then iOS and finally with UWP simply to get better error results. Ideally I would like it working on iOS. I have a B2C client and a web API set up and working. How do I know this? Because I have the “active-directory-b2c-wpf” example working fine.

In the UWP client the application runs when when I click the sign in button a dialog appears with the progress spinner and then after a second or two I get an error message “We can’t connect to the service you need right now. Check your network connection or tray again later”. If I close this window the client code throws an exception:

Microsoft.Identity.Client.MsalException: WAB authentication failed ---> System.IO.FileNotFoundException: The specified protocol is unknown. (Exception from HRESULT: 0x800C000D)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

If I compare what is going down the wire from the WPF client and the UWP client when the AcquireTokenAsync method is called they differ.

The WPF client sends the following information (xxxx replaces sensitive info):

GET /te/xxxxx.onmicrosoft.com/b2c_1_susi/oauth2/v2.0/authorize?scope=https%3A%2F%2Fxxxxx.onmicrosoft.com%2Fcms%2Faccess+offline_access+openid+profile&response_type=code&client_id=xxxxx&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&client-request-id=fcdb2f65-9ef2-4c0b-af69-cc337d4067d6&x-client-SKU=MSAL.Desktop&x-client-Ver=1.1.0.0&x-client-CPU=x64&x-client-OS=Microsoft+Windows+NT+6.2.9200.0&prompt=select_account&code_challenge=9ErDqtNfDqGU7IFtTVBccVILq49xl_h50xyv8S25cE8&code_challenge_method=S256&state=a006328c-036b-487b-a9e9-0813facaa55a HTTP/1.1

The UWP client sends something of the form:

GET /tfp/xxxxx.onmicrosoft.com/b2c_1_susi/v2.0/.well-known/openid-configuration HTTP/1.1

I have checked and double checked the b2c-xamarin-native code compared to the b2c-wpf and they are identical apart from the call to AcquireTokenAsync.

In WPF it looks like the following:

 authResult = await App.PublicClientApp.AcquireTokenAsync(
               App.ApiScopes,
               GetUserByPolicy(App.PublicClientApp.Users, App.PolicySignUpSignIn),
               UIBehavior.SelectAccount, string.Empty, null, App.Authority);

for UWP it looks like:

 AuthenticationResult ar = await App.PCA.AcquireTokenAsync(
                  App.ApiScopes,
                  GetUserByPolicy(App.PCA.Users, App.PolicySignUpSignIn),
                  App.UiParent);

Do I need to configure something different on the backend to get mobile/UWP clients working or do I need to look elsewhere?

Any help would be appreciated.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:21

github_iconTop GitHub Comments

4reactions
matgutschowcommented, Oct 20, 2017

Ran into this issue as well running the UWP project, after looking at the sample code with the sample tenant and looking at the PCA object I was able to find that the RedirectUri property on the PublicClientApplication gets overridden from what you put in the UserDetailsClient\App.cs. If you look in the UserDetailsClient.UWP/MainPage.cs you will see it gets overridden.

If you copy that RedirectUri and add that to your B2C application ‘Custom Redirect URI’ along with the msal<applicationID>://auth from the directions and save it it should work.

1reaction
n8allancommented, Dec 5, 2019

Thank you @jennyf19 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting error message" We can't connect to the service you ...
Getting error message" We can't connect to the service you need right now. Check your network connection or try this again later".
Read more >
We can't connect to the service you need right now. Please ...
The error message is absolutely because you have another version on your computer. Delete everything Minecraft, clear your browsers and take out the...
Read more >
We are unable to connect right now. Please check your ...
I have a new Windows 10 device that I joined to Azure AD. Everything's okay. But once I sign out from the local...
Read more >
How to Fix the "Windows Can't Connect to This Network" ...
Open Windows Settings. · Go to Network & internet > Wi-Fi. · Select Manage known networks. · Click the Forget button next to...
Read more >
How to Fix “We Are Unable to Connect Right Now” in Outlook
Troubleshoot Your Internet Connection · Turn Off “Work Offline” Mode · Restart Outlook · Enable the Network Connectivity Status Indicator (NCSI) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found