Heres's a description of my problem:
3 - Activated log4net logging
4 - When calling client.ProcessUserAuthorization() I get the infamous
Failed to obtain access token. Authorization Server reports reason: (unknown); I saw that Andrew mentioned on StackOverflow that this was due to an out-of-date implementation of the OAuth2 protocol, he was referring to Facebook, but the problem may be the same
5 - On the log file, I get this:
2012-03-04 16:32:32,324 (GMT+0) [6] DEBUG DotNetOpenAuth.Messaging.Channel - Preparing to send AccessTokenAuthorizationCodeRequest (2.0) message.
2012-03-04 16:32:32,324 (GMT+0) [6] INFO DotNetOpenAuth.Messaging.Channel - Prepared outgoing AccessTokenAuthorizationCodeRequest (2.0) message for https://foursquare.com/oauth2/access_token:
code: ____removed____
redirect_uri: http://localhost:59721/Foursquare.aspx
grant_type: authorization_code
client_id: ___removed___
client_secret: ___removed___
2012-03-04 16:32:32,324 (GMT+0) [6] DEBUG DotNetOpenAuth.Messaging.Channel - Sending AccessTokenAuthorizationCodeRequest request.
2012-03-04 16:32:36,604 (GMT+0) [6] DEBUG DotNetOpenAuth.Http - HTTP POST https://foursquare.com/oauth2/access_token
2012-03-04 16:32:37,058 (GMT+0) [6] DEBUG DotNetOpenAuth.Messaging - The following required parameters were missing from the DotNetOpenAuth.OAuth2.Messages.AccessTokenSuccessResponse message: {token_type,
}
2012-03-04 16:32:37,058 (GMT+0) [6] DEBUG DotNetOpenAuth.Messaging - The following required parameters were missing from the DotNetOpenAuth.OAuth2.Messages.AccessTokenFailedResponse message: {error,
}
2012-03-04 16:32:37,073 (GMT+0) [6] DEBUG DotNetOpenAuth.Messaging.Channel - Received UnauthorizedResponse response.
2012-03-04 16:32:37,073 (GMT+0) [6] INFO DotNetOpenAuth.Messaging.Channel - Processing incoming UnauthorizedResponse (2.0) message:
realm: Service
access_token: ___removed___
2012-03-04 16:32:37,089 (GMT+0) [6] DEBUG DotNetOpenAuth.Messaging.Channel - After binding element processing, the received UnauthorizedResponse (2.0) message is:
realm: Service
access_token: ___removed___
2012-03-04 16:32:37,089 (GMT+0) [6] ERROR DotNetOpenAuth.Messaging - Protocol error: Failed to obtain access token. Authorization Server reports reason: (unknown)
at DotNetOpenAuth.Messaging.ErrorUtilities.VerifyProtocol(Boolean condition, String message, Object[] args)
at DotNetOpenAuth.Messaging.ErrorUtilities.ThrowProtocol(String message, Object[] args)
at DotNetOpenAuth.OAuth2.ClientBase.UpdateAuthorizationWithResponse(IAuthorizationState authorizationState, EndUserAuthorizationSuccessAuthCodeResponse authorizationSuccess)
at DotNetOpenAuth.OAuth2.WebServerClient.ProcessUserAuthorization(HttpRequestInfo request)
at OAuthClient.Foursquare.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.foursquare_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
at System.Web.HttpRuntime.ProcessRequest(HttpWorkerRequest wr)
at Microsoft.VisualStudio.WebHost.Request.Process()
at Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Connection conn)
6 - The received access_token works fine, I tried it, however, there's something in the response that is causing it to throw an exception
Any ideas? I would be most grateful!
Thanks,
RP