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.
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);
{
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");
{
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