abujehad139 / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
0 stars 0 forks source link

OAuth1 two-legged authentication fails (401 Invalid Credentials) #231

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm having trouble using the OAuth1 two-legged authentication. The description 
of the .Net library says "The library supports OAuth1.0a and OAuth2.0 
authentication". The class OAuth2LeggedAuthenticator used to work properly (at 
least a few months ago).

What steps will reproduce the problem?

1. Authenticate using the OAuth2LeggedAuthenticator class
2. Retrieve an item (calendar, task, ...)

Code:

OAuth2LeggedAuthenticator auth = new OAuth2LeggedAuthenticator(key, secret, 
user, domain);
CalendarService calendarService = new CalendarService(auth);
Events events = calendarService.Events.List(calendarId).Fetch();

Response with the revision 985a01d2a64e:

OK [200]

Response with the latest version (1.2.4573):

Google.Apis.Requests.RequestError
Invalid Credentials [401]
Errors [ Message[Invalid Credentials] Location[Authorization - header] 
Reason[authError] Domain[global] ]

What version of the product are you using? On what operating system?

google-api-dotnet-client-1.2.4573-beta.binary
Windows 7 with Visual Studio 2010

Other useful information:

I used fiddler in order to compare the authorization headers. It's weird 
because they both seem to be OK.

With the revision 985a01d2a64e:

oauth_version="1.0",
oauth_nonce="4e3ae8c0ac0a4b18bb4006c516aca1dc",
oauth_timestamp="1342142691",
oauth_consumer_key="123456789.apps.googleusercontent.com",
oauth_signature_method="HMAC-SHA1",
oauth_signature="g5%2BK2ylOdcKIPRnQp5nNR1mznx4%3D"

With the latest version (1.2.4573):

oauth_version="1.0",
oauth_nonce="aa80f13d49534657b66fe508165a6d8b",
oauth_timestamp="1342142831",
oauth_consumer_key="123456789.apps.googleusercontent.com",
oauth_signature_method="HMAC-SHA1",
oauth_signature="CExWlkamw46vbo9YgRlLVprTxYE%3D"

Do you have an idea? As the OAuth2 Service Account authentication is not 
implemented yet, I'm stuck in my project. Thanks!

Original issue reported on code.google.com by guillaume.zurbach@gmail.com on 13 Jul 2012 at 2:04

GoogleCodeExporter commented 9 years ago
Has there been any progress on this Issue? It is also causing me problems.

Original comment by brushfir...@learnstyle.com on 1 Oct 2012 at 9:18

GoogleCodeExporter commented 9 years ago
I believe the server has stopped accepting OAuth1 as a valid authentication 
model. 
Please see the Authentication used in the samples. 

Some people have started using the new and as yet poorly documented Assertion 
flow 

see
http://code.google.com/p/google-api-dotnet-client/source/browse/Src/GoogleApis.A
uthentication.OAuth2/DotNetOpenAuth/AssertionFlowClient.cs

and 

http://code.google.com/p/google-api-dotnet-client/source/browse/Src/GoogleApis.A
uthentication.OAuth2.Tests/DotNetOpenAuth/AssertionFlowClientTest.cs

Hope that helps,
David.

Original comment by davidwat...@google.com on 5 Oct 2012 at 5:14