This project is read-only.

my first success with Oauth (Yeah!!)

Apr 27, 2011 at 1:05 PM

thanks to your lib class and your c# example i wrote this in VB.net

Public Class Oauth

Const myConsumerKey As String = "4be261761b90235e6a0dfade3784ab8904d954fdb"    
Const myConsumerSecret As String = "mysecretcode"    
Const url_Request_token As String = "http://www.urban-rivals.com/api/auth/request_token.php" 
Const url_Authorize_token As String = "http://www.urban-rivals.com/api/auth/authorize.php" 
Const url_Convert_authorized_token_into_access_token As String = "http://www.urban-rivals.com/api/auth/access_token.php" 
Const url_Call_remote_methods_using_access_token As String = "http://www.urban-rivals.com/api/" 
Const url_realm As String = "http://www.urban-rivals.com/"       <==== NOT SURE FOR THIS LINE


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click        

Dim c As Consumer = New Consumer(myConsumerKey, myConsumerSecret) 
Dim reqToken As RequestToken = c.ObtainUnauthorizedRequestToken(url_Request_token, url_realm)

Process.Start(Consumer.BuildUserAuthorizationURL(url_Authorize_token, reqToken))

Console.Out.WriteLine("Input verifier")
Dim verifier As String = Console.In.ReadLine()
verifier = verifier.TrimEnd("\r", "\n").ToString
Dim accessToken As AccessToken = c.RequestAccessToken(verifier, reqToken, url_Convert_authorized_token_into_access_token, url_realm)

 

End Sub

it works fine, it opens the web page and ask me to autorize my application (exactly what i expect). I get a token.

http://www.urban-rivals.com/api/auth/authorize.php?oauth_token=cb52f9dfa2af5b7aa841cf30709fbb8104db80503

I click ok and after IE shows an empty page with address="http://www.urban-rivals.com/api/auth/authorize.php"
and "verifier" seems to be empty. 

I don't understand how works this part. It seems also vb doesn't wait my click on the authorize application button.

Apr 28, 2011 at 12:26 PM

YES !! it works. 

For Urban Rival, there is no verifier parameter, so just stop the program with a message box during the authorisation phase and ... enjoy

my verifier = "";

Thanks for this very nice library