Skip to content

Instantly share code, notes, and snippets.

@jmyrland
Last active December 14, 2015 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmyrland/5150214 to your computer and use it in GitHub Desktop.
Save jmyrland/5150214 to your computer and use it in GitHub Desktop.
C# Console App for getting vimeo tokens. Based on VimeoDotNet.
This software uses VimeoDotNet to connect to Vimeo API. To support this project visit http://support.saeedoo.com.
ExecuteGetCommand: GET: http://vimeo.com/oauth/request_token?oauth_callback=oob&oauth_consumer_key=6a0863a7e1a977e0a11b7b1d44e4fd4fe2b099ee&oauth_nonce=12538763498766544664049620&oauth_signature=m97UWvPR%2fkHifaKh%2bLcUv1mio%2bM%3d&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1363166144&oauth_version=1.0&
ExecuteGetCommand: OK: http://vimeo.com/oauth/request_token?oauth_callback=oob&oauth_consumer_key=6a0863a7e1a977e0a11b7b1d44e4fd4fe2b099ee&oauth_nonce=12538763498766544664049620&oauth_signature=m97UWvPR%2fkHifaKh%2bLcUv1mio%2bM%3d&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1363166144&oauth_version=1.0&
[134B]: oauth_token=f5e46105426e91e42f3fb094e6301451&oauth_token_secret=594c8309381581eda2a1da71aa1cead935d1eaaf&oauth_callback_confirmed=true
The thread '<No Name>' (0x1b44) has exited with code 0 (0x0).
The thread '<No Name>' (0x14cc) has exited with code 0 (0x0).
ExecuteGetCommand: GET: http://vimeo.com/oauth/access_token?oauth_callback=oob&oauth_consumer_key=6a0863a7e1a977e0a11b7b1d44e4fd4fe2b099ee&oauth_nonce=1963498766623739572589981&oauth_signature=kHr0V3952DX1RiSUkZPsFXCszcs%3d&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1363166223&oauth_token=f5e46105426e91e42f3fb094e6301451&oauth_verifier=community-y8r78&oauth_version=1.0&
A first chance exception of type 'System.Net.WebException' occurred in System.dll
ExecuteGetCommand: FAIL: http://vimeo.com/oauth/access_token?oauth_callback=oob&oauth_consumer_key=6a0863a7e1a977e0a11b7b1d44e4fd4fe2b099ee&oauth_nonce=1963498766623739572589981&oauth_signature=kHr0V3952DX1RiSUkZPsFXCszcs%3d&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1363166223&oauth_token=f5e46105426e91e42f3fb094e6301451&oauth_verifier=community-y8r78&oauth_version=1.0&
ExecuteGetCommand: MSG: The remote server returned an error: (401) Unauthorized.
ExecuteGetCommand: RSP: Unauthorized
ExecuteGetCommand: GET: http://vimeo.com/api/rest/v2?method=vimeo.test.login&oauth_callback=oob&oauth_consumer_key=6a0863a7e1a977e0a11b7b1d44e4fd4fe2b099ee&oauth_nonce=5016349876662404058972142&oauth_signature=F1FUMlpHe8DmA%2bUteE2Mx41zfQw%3d&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1363166224&oauth_token=a8e598ead3c3fa04d832be660d90ec59&oauth_version=1.0&
ExecuteGetCommand: OK: http://vimeo.com/api/rest/v2?method=vimeo.test.login&oauth_callback=oob&oauth_consumer_key=6a0863a7e1a977e0a11b7b1d44e4fd4fe2b099ee&oauth_nonce=5016349876662404058972142&oauth_signature=F1FUMlpHe8DmA%2bUteE2Mx41zfQw%3d&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1363166224&oauth_token=a8e598ead3c3fa04d832be660d90ec59&oauth_version=1.0&
[179B]: <?xml version="1.0" encoding="UTF-8"?>
<rsp generated_in="0.0069" stat="fail">
<err code="401" expl="The oauth_signature passed was not valid." msg="Invalid signature"/>
</rsp>
Getting unauthorized token..Done!
Token: 2abb400271b54d1f80619f02e7eb44c4
Secret: 0676ca1b2dcc3e0a1b88a5a79e62d502fd47779a
----------------------------------------------------
Authorize and copy the verification code..
----------------------------------------------------
Enter verification code: channel-zdt7y
Getting AccessToken with verifier [channel-zdt7y]... Done!
----------------------------------------------------
Users token:
Token:
Secret:
Logging in... Failed..
Trying hardcoded tokens:
Token: a8e598ead3c3fa04d832be660d90ec59
Secret: a49bf0d861d7b9c5224b182d437d01802bdc067e
Logging in... Failed..
Press any key to exit.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vimeo.API;
namespace VimeoConsole
{
class Program
{
static void Main(string[] args)
{
var api = new VimeoClient("6a0863a7e1a977e0a11b7b1d44e4fd4fe2b099ee", "434b06940627ca9a11bcbd47457826d22e8323e6");
Console.Write("Getting unauthorized token..");
api.GetUnauthorizedRequestToken();
Console.WriteLine("Done!");
Console.WriteLine("\tToken:\t{0}", api.Token);
Console.WriteLine("\tSecret:\t{0}", api.TokenSecret);
Console.WriteLine("----------------------------------------------------");
Console.WriteLine("");
var url = api.GenerateAuthorizationUrl();
Console.WriteLine("\tAuthorize and copy the verification code..");
System.Diagnostics.Process.Start(url);
Console.WriteLine("");
Console.WriteLine("----------------------------------------------------");
Console.WriteLine("");
Console.Write("Enter verification code: ");
var verifier = Console.ReadLine();
Console.WriteLine("");
Console.Write("Getting AccessToken with verifier [{0}]... ", verifier);
api.GetAccessToken(verifier);
Console.WriteLine("Done!");
Console.WriteLine("");
Console.WriteLine("----------------------------------------------------");
Console.WriteLine("");
Console.WriteLine("Users token: ");
Console.WriteLine("\tToken:\t{0}", api.Token);
Console.WriteLine("\tSecret:\t{0}", api.TokenSecret);
Console.WriteLine("");
Console.Write("Logging in... ");
var isLoggedIn = api.Login();
var message = isLoggedIn ? "Login successfull!" : "Failed..";
Console.WriteLine(message);
if (!isLoggedIn)
{
// Retry with account token copied from vimeo:
const string token = "a8e598ead3c3fa04d832be660d90ec59";
const string secret = "a49bf0d861d7b9c5224b182d437d01802bdc067e";
Console.WriteLine("");
Console.WriteLine("Trying hardcoded tokens:");
Console.WriteLine("\tToken:\t{0}", token);
Console.WriteLine("\tSecret:\t{0}", secret);
Console.WriteLine("");
Console.Write("Logging in... ");
isLoggedIn = api.Login(token, secret);
message = isLoggedIn ? "Login successfull!" : "Failed..";
Console.WriteLine(message);
}
Console.WriteLine("");
Console.WriteLine("Press any key to exit.");
// Pause..
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment