We have implemented ADAL authentication using Dependency service in Xamarin Forms. We have came across a strange issue, when the user's password is recently changed, they are not able to get the access token in their client app.
The expectation is to prompt the user to update the latest credential, in order to get the refreshed access token. But this doesn't seem to work.
Code for UWP:
[assembly: Dependency(typeof(SampleApp.UWP.Helper.Authenticator))]
namespace SampleApp.UWP.Helper { class Authenticator : IAuthenticator {
public string ReturnUri = Windows.Security.Authentication.Web.WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString();
public async System.Threading.Tasks.Task<AuthenticationResult> Authenticate(string authority, string resource, string clientId, string returnUri=null)
{
var authContext = new AuthenticationContext(authority);
var authResult = await authContext.AcquireTokenAsync(resource, clientId, new Uri(ReturnUri),
new PlatformParameters(PromptBehavior.Auto,true));
return authResult;
}
}
}
Thanks, Karthik