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.

How to handle service down case is Azure AD B2c.

See original GitHub issue

Hi, I am using Microsoft.Identity.Client version 4.22.0 in my Xamarin Forms application for Authentication. I have two questions related to handling of “The webpage is not available”. case.

Qn1 : Is there any way I can retry the login request if the service / B2c is down, after a specific time interval? Qn2: How I can comeback to the calling method if the service is down? So that I can provide a readable method to the user other than failed sign-in url.

I am calling the below methods for login and revalidating the existing token.

   var result = await _authenticationClient.AcquireTokenInteractive(_settings.Scopes)
            .WithParentActivityOrWindow(ParentActivityOrWindow)
           .WithPrompt(Prompt.ForceLogin)
           .WithUseEmbeddedWebView(true)
           .WithExtraQueryParameters(AppIdentifier)
           .ExecuteAsync();

   var accounts = await _authenticationClient.GetAccountsAsync();
                var authResult = await _authenticationClient.AcquireTokenSilent(_settings.Scopes, GetAccountByPolicy(accounts, _settings.SignInPolicy))
                 .ExecuteAsync();

And this is the situation I am trying to tackle.

image

Please help.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bgavrilMScommented, Nov 9, 2020

Hi @stezma -

I don’t think we have a good solution for this yet. The main mitigation developers use today is to detect if the network is down PRIOR to making a token request.

Generally timeouts in .NET world are done using the cancellation mechanism. Notice that ExecuteAsync accept a token. That said the library does not necessarily need to obey your cancellation request, either because it cannot or because the execution has reached a point where it’s too late to cancel.

I think currently we do not react to cancellation in this case, but we probably should, by throwing an OperationCancelledException. Would this help? Does it maybe work today?

0reactions
jennyf19commented, Nov 18, 2020

@bgavrilMS yes, i think this is on our list of asks w/b2c. i’ll mark this as external.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way to check if Azure B2C is down and generate ...
I understand that you are looking for a way to programmatically poll the service health of B2C service and generate automatic alerts from...
Read more >
Troubleshoot Azure AD B2C custom policies and user flows
The user select Cancel button before authenticating to the identity provider itself. In this case, Azure AD B2C service returns error code ...
Read more >
Best practices for Azure AD B2C - Active Directory
Stay up to date with Azure AD B2C product updates and announcements. File a support request for Azure AD B2C technical issues. Billing...
Read more >
What is Azure Active Directory B2C?
Azure AD B2C is a customer identity access management (CIAM) solution capable of supporting millions of users and billions of authentications ...
Read more >
Access and review audit logs - Azure AD B2C
To download Azure AD B2C audit log events via the API, filter the logs on the B2C category. To filter by category, use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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