private async Task<Credential> CreateCredentialAsync(CredentialRequestInfo info)
{
OAuthTokenCredential credential = null;
try
{
// Create generate token options if necessary
if (info.GenerateTokenOptions == null)
{
info.GenerateTokenOptions = new GenerateTokenOptions();
}
// AuthenticationManager will handle challenging the user for credentials
credential = await AuthenticationManager.Current.GenerateCredentialAsync
(
info.ServiceUri,
info.GenerateTokenOptions
) as OAuthTokenCredential;
}
catch (Exception ex)
{
// Exception will be reported in calling function
throw (ex);
}
return credential;
}