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?