google / google-api-javascript-client

Google APIs Client Library for browser JavaScript, aka gapi.
Apache License 2.0
3.22k stars 1.06k forks source link

DotNetOpenAuth.Messaging.ProtocolException #454

Open Cunlai opened 6 years ago

Cunlai commented 6 years ago

Hi, I am working on some legacy code about google oauth. I always have a problem on production server. There is no any error in dev or staging. Any idea? Thanks!

Here is the error msg:

Exception Type: DotNetOpenAuth.Messaging.ProtocolException Exception Message: Error occurred while sending a direct message or getting the response. Trace: at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options) at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request) at DotNetOpenAuth.Messaging.Channel.GetDirectResponse(HttpWebRequest webRequest) at DotNetOpenAuth.Messaging.Channel.RequestCore(IDirectedProtocolMessage request) at DotNetOpenAuth.Messaging.Channel.Request(IDirectedProtocolMessage requestMessage) at DotNetOpenAuth.OAuth2.ClientBase.UpdateAuthorizationWithResponse(IAuthorizationState authorizationState, EndUserAuthorizationSuccessAuthCodeResponse authorizationSuccess) at DotNetOpenAuth.OAuth2.WebServerClient.ProcessUserAuthorization(HttpRequestInfo request) at OAuth2GAWeb.v3.OAuth2GAWeb.getAuthorization(WebServerClient _client) in C:\Dev\git\ISolution\Legacy\CodeFiles\OAuth2GAWeb_v3.vb:line 275 at Google.Apis.Authentication.OAuth2.OAuth2Authenticator`1.LoadAccessToken() at OAuth2GAWeb.v3.OAuth2GAWeb.authenticateOAuth2_userConsent() in C:\Dev\git\ISolution\Legacy\CodeFiles\OAuth2GAWeb_v3.vb:line 120 Inner Exception Type: System.Net.WebException Inner Exception Message: The remote server returned an error: (400) Bad Request. Inner Trace: at System.Net.HttpWebRequest.GetResponse() at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options)

Cunlai commented 6 years ago

This issue was fixed by using google webapi instead of ProcessUserAuthorization.

knoxcard commented 6 years ago

Close ticket?

ErcNovelT commented 6 years ago

This issue was fixed by using google webapi instead of ProcessUserAuthorization.

Hello Cunlai,

Do you mind to post more details about the fix you did please? We are also using the same third party library and we have the same issue. It would be great if you can share how you fixed that one.

Many thanks!

mcrowson commented 6 years ago

@ErcNovelT looks like the DotNetOpenAuth stopped working for some reason for us as well at that exact same spot. We also used the Google.Apis to get going again. A good writeup of how to us here

ErcNovelT commented 6 years ago

Ok thanks for your feedback. On our side we by-passed DNOA to get the access token (it seems working for now) but we will considere another way to communicate with the Google API. Thanks again!