ajmal744 / 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

Error occurred while sending a direct message or getting the response. #372

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
{"The remote server returned an error: (400) Bad Request."}  

Stack Trace:
 at Google.Apis.Requests.ClientServiceRequest`1.Execute() in c:\code.google.com\google-api-dotnet-client\default\Tools\BuildRelease\bin\Release\release140\default\Src\GoogleApis\Apis\Requests\ClientServiceRequest.cs:line 88
   at WindowsFormsApplication1.Form1.button1_Click(Object sender, EventArgs e) in c:\Users\samso_000\Documents\Visual Studio 2012\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs:line 57
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at WindowsFormsApplication1.Program.Main() in c:\Users\samso_000\Documents\Visual Studio 2012\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Program.cs:line 19
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Original issue reported on code.google.com by sams...@gmail.com on 12 Aug 2013 at 1:04

GoogleCodeExporter commented 9 years ago
Here is the code:

Google.Apis.Services.BaseClientService.Initializer ds = new 
Google.Apis.Services.BaseClientService.Initializer();
            ds.ApiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
            string scope_url = "https://www.googleapis.com/auth/" + "devstorage.readonly";
            string client_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com";

            string key_file = @"xxxxxxxxxxxxxxxxxxxxxxxxxxx-privatekey.p12";
            string key_pass = "notasecret";

            AuthorizationServerDescription desc = GoogleAuthenticationServer.Description;

            //key: Load up and decrypt the key
            X509Certificate2 key = new X509Certificate2(key_file, key_pass, X509KeyStorageFlags.Exportable);

            //client: we're using the AssertionFlowClient, because we're logging in with our certificate
            AssertionFlowClient client = new AssertionFlowClient(desc, key) { ServiceAccountId = client_id, Scope = scope_url };
            OAuth2Authenticator<AssertionFlowClient> auth = new OAuth2Authenticator<AssertionFlowClient>(client, AssertionFlowClient.GetState);

            ds.Authenticator = auth;
            AndroidPublisherService service = new AndroidPublisherService(ds);
            PurchasesResource.GetRequest ret = service.Purchases.Get("com.xxxxxx.ui", "xxxxxxxxxx.xxxxxxxxx", "34wfdsf3cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");

            var rt = ret.Execute();

Original comment by sams...@gmail.com on 12 Aug 2013 at 1:10

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 27 Sep 2013 at 10:02

GoogleCodeExporter commented 9 years ago
Please use our new OAuth2 library.
More information is available in our OAuth2 wiki page 
https://code.google.com/p/google-api-dotnet-client/wiki/OAuth2

I'm closing this issue, let me know you encounter a new problem with the new 
OAuth2 library.

Original comment by pele...@google.com on 28 Nov 2013 at 5:59

GoogleCodeExporter commented 9 years ago
HI Team,

Please send me the link for new OAuth2 library  .

Original comment by prashant...@gmail.com on 11 Sep 2014 at 8:57

GoogleCodeExporter commented 9 years ago
HI Team,

I am use Google.Api Dll
Version : 1.6.0.16897

when i am feching Circle Data for 
scope: https://www.googleapis.com/auth/plus.login

ERROR : Error occurred while sending a direct message or getting the response.

Original comment by prashant...@gmail.com on 11 Sep 2014 at 11:41

GoogleCodeExporter commented 9 years ago
I think you should use our latest Plus library - Downoad it from NuGet - 
https://www.nuget.org/packages/Google.Apis.Plus.v1/

Original comment by pele...@google.com on 11 Sep 2014 at 1:27