Quantcast
Channel: Azure Active Directory forum
Viewing all articles
Browse latest Browse all 16000

After 1 and 2 success login to AzureAD, subsequent login cannot work

$
0
0
I used below code and nuget to login to my Paid Acct in AzureAD with Xamarin forms.
Nuget : Microsoft.IdentityModel.clients.ActiveDirectory

I have set permission : internet and access network state
The first and 2nd attempt to login were OK.

problem:

The subsequent attempts to login stuck at "Take you to your organization sign-in page".This means there is no result returned and the activity indicator kept running in circle or indefinitely.
Why cannot login again? Why I can login the 1st and 2nd attempts? I have used the correct parameters.

public interface IAuthenticationService
 {
  
Task<AuthenticationResult> Authenticate(string authority, string resource, string clientId, string returnUri);
 
}

private async void Login_Clicked(object sender, System.EventArgs e)
{
   var authenticationService = DependencyService.Get<IAuthenticationService>();
 try
 {
    var authenticationResult = await authenticationService.Authenticate(
    AuthenticationParameters.Authority,
    AuthenticationParameters.GraphResourceUri,
    AuthenticationParameters.ApplicationId,
    AuthenticationParameters.ReturnUri);
                if (authenticationResult != null)
                {
                    var strToken = authenticationResult.AccessToken;
                     
                    await DisplayAlert("Success", strToken, "Ok");
                }

 }
   catch(Exception ex){

     string strErr = ex.ToString();
     await DisplayAlert("Failure", "Authentication failed.", "Ok");
     }
  }

Please help. 

Thanks

               

Viewing all articles
Browse latest Browse all 16000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>