Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
xAuth always failed with 401 (c# code)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
James Zhou  
View profile  
 More options Jun 27 2012, 4:31 am
From: James Zhou <jameszhoubeij...@gmail.com>
Date: Wed, 27 Jun 2012 01:31:16 -0700 (PDT)
Local: Wed, Jun 27 2012 4:31 am
Subject: xAuth always failed with 401 (c# code)

I have enabled xAuth of my Tumblr app and I'm sure the signature is correct
(tested with the sample values of twitter sample  and got same signature -
https://dev.twitter.com/docs/oauth/xauth) , but I always got 401 error with
below c# code:

            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URL_ACCESS_TOKEN);
            request.Headers.Add("Authorization",authHeader.ToString());

//the header content is: OAuth oauth_consumer_key="****",oauth_nonce="8632175",oauth_signature="LMkN3SZA%2 FbCJqiVgz0cIilv7VLo%3D",oauth_signature_method="HMAC-SHA1",oauth_timestamp= "1340678985",oauth_version="1.0"

            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";

            StreamWriter requestWriter = new StreamWriter(request.GetRequestStream());
            requestWriter.Write(xauthParams.ToString());

//the post body is: x_auth_username=jameszhou%40high****.com&x_auth_password=test&x_auth_mode=c lient_auth
            requestWriter.Close();

            try
            {
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                Console.WriteLine(response.StatusCode.ToString());
            }
            catch(WebException ex)
            {
                Console.WriteLine(ex.Message);
            }

Anyone can give some insight on this?

Thanks!

James


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Zhou  
View profile  
 More options Jun 27 2012, 10:31 pm
From: James Zhou <jameszhoubeij...@gmail.com>
Date: Wed, 27 Jun 2012 19:31:51 -0700 (PDT)
Local: Wed, Jun 27 2012 10:31 pm
Subject: Re: xAuth always failed with 401 (c# code)

UPDATE: values for xauth of my code:

signature base string:
POST&https%3A%2F%2Fwww.tumblr.com%2Foauth%2Faccess_token&oauth_consumer_key%3DQBYdtcj***...

signature:
N7c89pX14bZN220qSpVDc0AK2yc%3D

oauth header:
OAuth
oauth_consumer_key="**********",oauth_nonce="2683686",oauth_signature="N7c8 9pX14bZN220qSpVDc0AK2yc%3D",oauth_signature_method="HMAC-SHA1",oauth_timest amp="1340850029",oauth_version="1.0"

post body:
x_auth_username=jameszhou%40h*****.com&x_auth_password=*******&x_auth_mode= client_auth


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Weebs  
View profile  
 More options Jun 28 2012, 8:34 pm
From: Weebs <patriotss...@gmail.com>
Date: Thu, 28 Jun 2012 17:34:21 -0700 (PDT)
Local: Thurs, Jun 28 2012 8:34 pm
Subject: Re: xAuth always failed with 401 (c# code)

Maybe my post didn't get submitted yesterday but, the I noticed your post
body is not sorted properly. Mine is mode&password&username.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Zhou  
View profile  
 More options Jun 29 2012, 12:44 am
From: James Zhou <jameszhoubeij...@gmail.com>
Date: Thu, 28 Jun 2012 21:44:57 -0700 (PDT)
Local: Fri, Jun 29 2012 12:44 am
Subject: Re: xAuth always failed with 401 (c# code)

Thank you. I tried to sort the body as your suggestion, but no luck :-(


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven Pears  
View profile   Translate to Translated (View Original)
 More options Jun 29 2012, 1:13 am
From: Steven Pears <steven.pe...@live.co.uk>
Date: Thu, 28 Jun 2012 22:13:12 -0700 (PDT)
Local: Fri, Jun 29 2012 1:13 am
Subject: Re: xAuth always failed with 401 (c# code)

The parameters don't need to be ordered in the post body - as long as
they're ordered in the OAuth details. It looks like this is a signature
issue - and will require more details about your implementation.

Have you tried using an OAuth library for a comparison of values? A really
straight forward one for .NET is Hammock, which I used before I wrote my
own and can handle XAuth requests, and then you can see if you get the same
result.

I'm working on wiring up some C# examples for this kind of thing, so
hopefully in the future this will be less of a problem.

Steven


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Zhou  
View profile  
 More options Jul 1 2012, 9:57 pm
From: James Zhou <jameszhoubeij...@gmail.com>
Date: Sun, 1 Jul 2012 18:57:58 -0700 (PDT)
Local: Sun, Jul 1 2012 9:57 pm
Subject: Re: xAuth always failed with 401 (c# code)

Thank you Steven! Please do let me know when the c# examples ready


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »