本文整理汇总了C#中UserStore.authenticate方法的典型用法代码示例。如果您正苦于以下问题:C# UserStore.authenticate方法的具体用法?C# UserStore.authenticate怎么用?C# UserStore.authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserStore
的用法示例。
在下文中一共展示了UserStore.authenticate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Authenticate
internal static AuthenticationResult Authenticate(String username, String password, String consumerKey, String consumerSecret, String evernoteHost, UserStore.Client userStore)
{
AuthenticationResult authResult;
try
{
authResult = userStore.authenticate(username, password, consumerKey, consumerSecret);
}
catch (EDAMUserException ex)
{
String parameter = ex.Parameter;
EDAMErrorCode errorCode = ex.ErrorCode;
if (parameter.ToLower() == "consumerkey")
{
throw new ApplicationException("API Key Missing. \r\n Please download latest en2ki release from homepage");
}
else
{
throw new ApplicationException(String.Format("Authentication Failed \r\n (Make sure {0} is correct)", parameter));
}
}
return authResult;
}
示例2: GetAuthToken
/// <summary>
/// 認証
/// </summary>
/// <param name="userStore"></param>
/// <returns></returns>
private string GetAuthToken(UserStore.Client userStore)
{
try
{
AuthenticationResult authResult = null;
authResult = userStore.authenticate(mUserName, mPassword, mConsumerKey, mConsumerSecret, false);
//authResult = userStore.authenticate(mUserName, mPassword, mConsumerKey, mConsumerSecret, true);
return authResult.AuthenticationToken;
}
catch (EDAMUserException ex)
{
EDAMErrorCode errorCode = ex.ErrorCode;
String param = ex.Parameter;
Console.WriteLine("エラーコード:" + errorCode);
Console.WriteLine("パラメータ:" + param);
Console.WriteLine("mConsumerKey: " + mConsumerKey);
Console.WriteLine("mEvernoteHost: " + mEvernoteHost);
throw new ApplicationException("認証に失敗しました。", ex);
}
}