jeisenberg / goauth2

Automatically exported from code.google.com/p/goauth2
Other
0 stars 0 forks source link

JWT example yields "invalid_grant" #20

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create service account credentials in the API console and download the 
private key
2. Populate example.client_secrets.json accordingly
3. Convert p12 private key to pem using `openssl pkcs12 -in key.p12 -nocerts 
-nodes -out key.pem`
4. `go run main.go -k key.pem -s example.client_secrets.json`

What is the expected output? What do you see instead?
I'm not quite sure, but I don't exepect an error to occur.

What version of the product are you using? On what operating system?
go1.1.1, Mac OS X 10.8.4

I was trying to access Google Cloud Storage via “Service Accounts” and – 
among other libs –  I'm using `code.google.com/p/goauth2/oauth/jwt` to obtain 
the access token.
However, the `t.Assert()` call always yields something like:

    2013/06/12 19:28:57 assertion error:invalid response: 400 Bad Request

I dug a little bit into the code and also dumped the response body, which turns 
out to be

    {
      "error" : "invalid_grant"
    }

According to a Google search, this can be the result of a lot of things, most 
commonly clock-skew, which I don't think I have (I am synched to a NTP server).
Then I tried the provided example code which yields exactly the same error.

To be honest, I'm not quite sure if this is a bug or I am doing something 
wrong. 

Original issue reported on code.google.com by su...@surmair.de on 19 Jun 2013 at 1:27

GoogleCodeExporter commented 8 years ago
Oh god, I'm embarrassed. Please close this. Turns out my copy of the repo 
wouldn't update due to a locally broken hg. New version works just fine.

Original comment by su...@surmair.de on 19 Jun 2013 at 3:18

GoogleCodeExporter commented 8 years ago

Original comment by gmle...@google.com on 28 Apr 2014 at 5:27