-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Obrzut wrote:
> Hi,
>
> I have been working on an program that will eventually access the
> Twitter site.
>
> But, I have found the very first stage of OAuth very cumbersome.
>
> Basically, I have the following code;
>
> Dim url As String = "http://twitter.com/oauth/request_token"; Dim
> xml As String = "" Dim OAuth As New OAuth_Twitter Dim O As New
> OAuth.OAuthBase Dim consumerKey As String = "CgZiTeNqGk2c0eZSdb9qg"
>  Dim consumerSecret As String =
> "Sf7DGMTiK4cyU8qOuqOWX4yCNCwAdcRAlAj02cOA" Dim token As String = ""
>  Dim tokenSecret As String = "" Dim Method As String = "GET" Dim
> outURL As String = "http://twitter.com/statuses/show/ 123.xml" Dim
> querystring = "" Dim URI As New Uri(url)
>
> Dim nonce As String = O.GenerateNonce() Dim timeStamp As String =
> O.GenerateTimeStamp()
>
> REM            //Generate Signature Dim sig As String =
> O.GenerateSignature(URI, _ consumerKey, _ consumerSecret, _ token,
> _ tokenSecret, _ Method, _ timeStamp, _ nonce, _ "", _ querystring)
>
>
> querystring &= "&oauth_signature=" & HttpUtility.UrlEncode (sig)
>
> Dim test As String = url & "?" & querystring
>
> Dim UR As System.Net.WebRequest = System.Net.WebRequest.Create
> (test)
>
> Dim str As System.IO.Stream = UR.GetResponse ().GetResponseStream()
>
>
> ---------------------------------------------------------------------------------------------------------------------
>
>
> The program fails at the end - where str is dimmed as a IO.Stream
> and a GetResponseStream() is attempted.
>
> I get a 401: Unauthorised message - and the program terminates.
>
> I think I am doing some thing wrong here, but I do not know what?
>
> Do I have to use GenerateSignature() from the OAuth class twice?
> How about using GenerateBaseSignature()?
>
> I am really confuzzled. Ha!
>
> Does anyone here know anything about VB.NET and OAuth
> implementations in this language?
Hi again,

I've written a Twitter OAUth library in C# that you can use--all you
have to do is compile it as a DLL and reference it in your VB project,
it should work just fine from VB (.NET is interoperable that way, no
need to convert). You can download a binary package from
http://code.google.com/p/twarp/downloads/list (OAuth.Twitter.zip), it
contains the library + all the dependencies. Sample code on using the
library, both asynchronously and synchronously (from C#, should be
easily convertible to VB) is available in the
http://code.google.com/p/twarp/source/browse/#svn/trunk/src/Libraries/OAuth.Twitter/Samples
folder. The library requires .NET 3.0 and higher, and is also portable
to Mono. :)

Cheers,

- --
Bojan Rajkovic <boj...@brandeis.edu>
Biochemistry '10, Brandeis University
PGP Signature Key ID: 0x8783D016
PGP Encryption Key ID: 0x2497B8B2
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJKQ+XpAAoJEO4IwQyHg9AWvVwP/iA8cd9ZgxWevon2tOXbMRsD
Zi5942UUuH/8RVaT+OswBgTRFf764JzYzqA5Sj+tKGn8ESs0QyGoaFINSNIkOENj
HSbI+g1MKQzv7fc5Woz6QBE9rELvSj/M+0E9j4FzX3kyevchEM2ImSgVWNxkINLv
QuI5raoJwKIrgaYR5tel20XqhJAdBCt3MofwfoHKvUd1aOmUajlKiN0QNXEUxeON
SZpwRXRryLgaDVIbqGsmWaii0Aj7lSdqCyYDZrA1+C6p+9x5a3s4JjFbQLgXm+c8
3IyZgTQBTJrRAPzGnm5/YizKNk2ycIlHI8tRmmUM2PMt8xPN6pNrOPtuNqpNZG4U
OdIgjVkX74TbHQouxbxEJYfQm0ua3gWjlEoDHR+JeDRKg5D4xzt9iljx4/Jq0b8a
pBIMYu+mXb/DhexIt4bjFPJCbqk/6s2ExGbWPiwwcFdXf3GF3WzGO1nx+Q4k1bDd
7fPhq2iLjJlAGcLx/yIgYTku4oqpYvWT8vwzEMlG35/pITuw6wSVZaqws9WnQghk
FHP+4OOYjvmkyoTZXZhIQ2ZJXPrcFFRyf0xAJXtcRECQ1B+e/PMSQVZCzaI45NtX
bztyAdGqfr9rFeFKOXkH8Gl9QXbGBbfBIdGOubx16iuWfPUoHk3rSwX2kE5Q/dPP
A5d+rokbxzvQY6TZR4sf
=8N+T
-----END PGP SIGNATURE-----

Reply via email to