pliablematter / simple-cloud-storage

A simple Java wrapper around the Google Cloud Storage API
81 stars 45 forks source link

400 Bad Request #2

Open gstub opened 10 years ago

gstub commented 10 years ago

Hi,

I've followed the directions to set this up, but I keep getting a 400 Bad Request error when I build it. I downloaded the key, set the client ID to the account ID (I didn't see anything named account ID in the developer console) and set the project ID. Below is my error:


Test set: com.pliablematter.cloudstorage.CreateBucketTest

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.057 sec <<< FAILURE! testCreateBucket(com.pliablematter.cloudstorage.CreateBucketTest) Time elapsed: 1.015 sec <<< ERROR! com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request { "error" : "invalid_grant" } at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105) at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:332) at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:352) at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:269) at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:454) at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:215) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:854) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460) at com.pliablematter.cloudstorage.CloudStorage.listBuckets(CloudStorage.java:179) at com.pliablematter.cloudstorage.CreateBucketTest.testCreateBucket(CreateBucketTest.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Any idea as to how to fix this?

dAti-zz commented 10 years ago

Hello,

I really don't know. Maybe they changed code for GCS. Did you include .p12 key ? On 16 Jul 2014 21:29, "gstub" notifications@github.com wrote:

Hi,

I've followed the directions to set this up, but I keep getting a 400 Bad Request error when I build it. I downloaded the key, set the client ID to the account ID (I didn't see anything named account ID in the developer

console) and set the project ID. Below is my error:

Test set: com.pliablematter.cloudstorage.CreateBucketTest

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.057 sec <<< FAILURE! testCreateBucket(com.pliablematter.cloudstorage.CreateBucketTest) Time elapsed: 1.015 sec <<< ERROR! com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request { "error" : "invalid_grant" } at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105) at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:332) at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:352) at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:269) at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:454) at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:215) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:854) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460) at com.pliablematter.cloudstorage.CloudStorage.listBuckets(CloudStorage.java:179) at com.pliablematter.cloudstorage.CreateBucketTest.testCreateBucket(CreateBucketTest.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Any idea as to how to fix this?

— Reply to this email directly or view it on GitHub https://github.com/pliablematter/simple-cloud-storage/issues/2.

gstub commented 10 years ago

Yes I included the key. I also noticed you had a sample bucket name in the code, I changed that to my bucket name. I'll continue to investigate to see if I can find the issue.

dAti-zz commented 10 years ago

Okay GCS on Android is pretty difficult but App Engine is easy.

Grtz On 17 Jul 2014 17:19, "gstub" notifications@github.com wrote:

Yes I included the key. I also noticed you had a sample bucket name in the code, I changed that to my bucket name. I'll continue to investigate to see if I can find the issue.

— Reply to this email directly or view it on GitHub https://github.com/pliablematter/simple-cloud-storage/issues/2#issuecomment-49321188 .

twmht commented 10 years ago

@gstub, I also get this problem, did you solve that?

Chavjoh commented 9 years ago

I had the same problem. Use the email address instead of the client ID ;)