It's all about the answers!

Ask a question

Impossible to get a valid response from the third action of oauth connection


JP Javouhey (111) | asked Jan 15 '13, 12:06 p.m.
i have written a Vb.net code. the first two step are ok but the third always failed.

could somebody help us ?

the code of the step 3 (retrieve access token)
============================================================================
'Step 3:  Retrieve Access Token

        Console.WriteLine()
        Console.WriteLine("'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''")
        Console.WriteLine("Step 3:  Retrieve Access Token")

        normalized_url = ""
        normalized_request_params = ""
        oauth_timestamp = oauthHelper.GenerateTimeStamp()
        'oauth_timestamp = ""
        oauth_nonce = oauthHelper.GenerateNonce()

        signature = oauthHelper.GenerateSignature(New System.Uri(request_token_url), consumer_key, consumer_secret, _
                                                  oauth_token, oauth_token_secret, "POST", oauth_timestamp, oauth_nonce, _
                                                  OAuth.OAuthBase.SignatureTypes.PLAINTEXT, normalized_url, normalized_request_params)

        Console.WriteLine("signature = " & signature)
        Console.WriteLine("oauth_timestamp = " & oauth_timestamp)
        Console.WriteLine("oauth_nonce = " & oauth_nonce)
        Console.WriteLine("normalized_url=" & normalized_url)
        Console.WriteLine("normalized_request_params=" & normalized_request_params)

        request_params = "oauth_consumer_key=" & consumer_key & _
                         "&oauth_token=" & oauth_token & "&oauth_signature=" & signature & _
                         "&oauth_signature_method=PLAINTEXT" & "&oauth_timestamp=" & oauth_timestamp & _
                         "&oauth_nonce=" & oauth_nonce & "&oaut_version=1.0"

        Dim access_request As HttpWebRequest = HttpWebRequest.Create(access_token_url)

        access_request.Method = "POST"
        access_request.ContentType = "application/x-www-form-urlencoded; charset=utf-8"
        access_request.Headers.Add("oauth_signature", signature)
        access_request.Headers.Add("oauth_signature_method", "PLAINTEXT")
        access_request.Headers.Add("oauth_timestamp", oauth_timestamp)
        access_request.Headers.Add("oauth_nonce", oauth_nonce)
        access_request.Headers.Add("oauth_version", "1.0")

        writer = New StreamWriter(access_request.GetRequestStream())
        writer.Write(request_params)
        writer.Close()

        Try
            response = access_request.GetResponse()
        Catch ex As WebException
            response = ex.Response
        End Try

        Console.WriteLine("status code = " & response.StatusCode.ToString)
        Console.WriteLine("status desc = " & response.StatusDescription)
        stream = New StreamReader(response.GetResponseStream())
        data = stream.ReadToEnd()

        Console.WriteLine("data = " & data)

        response.Close()
===========================================================================


Log result

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 Step 1:  Retrieve Request Token
signature = ZZEFLBfilhzigssgvssv%26
oauth_timestamp = 1358266410
oauth_nonce = 9180800
normalized_url=
normalized_request_params=
address = https://10.10.12.222:9443/jts/oauth-request-token?
uri = https://10.10.12.222:9443/jts/oauth-request-token?
status code = OK
status desc = OK
data = oauth_token=54cf94da29b8412283bb1238f8399c47&oauth_token_secret=180eAQvdZHWSDi4VlNl1c0nc1iKyuw2UGuKqfMsTqbE%3D
oauth_token        = 54cf94da29b8412283bb1238f8399c47
oauth_token_secret = 180eAQvdZHWSDi4VlNl1c0nc1iKyuw2UGuKqfMsTqbE%3D

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Step 2:  Authenticate Request Token
Go to the following URL to authenticate:
uri = https://10.10.12.222:9443/jts/oauth-authorize?oauth_token=54cf94da29b8412283bb1238f8399c47

Press enter to continue:
status code = OK
status desc = OK

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Step 3:  Retrieve Access Token
signature = ZZEFLBfilhzigssgvssv%26180eAQvdZHWSDi4VlNl1c0nc1iKyuw2UGuKqfMsTqbE%253D
oauth_timestamp = 1358266410
oauth_nonce = 8526939
normalized_url=
normalized_request_params=
status code = Unauthorized
status desc = Non-Autorisé
data = oauth_problem=invalid_expired_token

One answer



permanent link
Donald Mason (5155) | answered Feb 25 '13, 12:48 p.m.
Have you gotten this to work yet?

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.