コード例 #1
0
ファイル: Form1.cs プロジェクト: Reckfullz/tumblrM
 public async Task<Token> DoXAuthAsync(string userName, string password)
 {
     var factory = new OAuthClientFactory();
     var oauthClient = factory.Create(consumerKey, consumerSecret);
     try
     {
         Token requestToken = await oauthClient.GetRequestTokenAsync("https://www.tumblr.com/oauth/request_token");
         Uri uri = oauthClient.GetAuthorizeUrl(requestToken);
         token = await oauthClient.GetRequestTokenAsync(uri.ToString());
         if (token.IsValid)
         {
             //we've got the token. Tumblr access tokens do not expire, 
             //so it is a good idea to store it somewhere permanently so 
             //that it can be used from now on
             return token;
         }
         else
         {
             //should not happen
             return null;
         }
     }
     catch (OAuthException ex)
     {
         errormessage = ex.ToString();
         //an error occurred while performing xAuth
         return null;
     }
 }
コード例 #2
0
ファイル: Auth.cs プロジェクト: jakelauer/Vanilla
		public Auth()
		{
			var factory = new OAuthClientFactory();
			TumblrAuthClient = factory.Create(ConsumerKey, ConsumerSecret);
		}