google-api-go-client and BigQuery auth

326 views
Skip to first unread message

Vladimir Mihailenco

unread,
Dec 13, 2012, 7:35:14 AM12/13/12
to golan...@googlegroups.com
Hi,

Can someone give an example how to use google-api-go-client/bigquery with Service account? Am I right that this is the only way to use BigQuery without requiring user to use oAuth?

Vladimir Mihailenco

unread,
Dec 13, 2012, 8:12:00 AM12/13/12
to golang-nuts
My current code is here: https://gist.github.com/4276307 . Any hints what I am doing wrong?


On Thu, Dec 13, 2012 at 2:35 PM, Vladimir Mihailenco <vladimi...@gmail.com> wrote:
Hi,

Can someone give an example how to use google-api-go-client/bigquery with Service account? Am I right that this is the only way to use BigQuery without requiring user to use oAuth?

--
 
 

Vladimir Mihailenco

unread,
Dec 15, 2012, 8:56:13 AM12/15/12
to golang-nuts
I've found following file: http://code.google.com/p/goauth2/source/browse/oauth/jwt/example/main.go

I run it: go run main.go -k=8d9858da26d1061b8532b98cf73306d1496cd353-privatekey.p12 -s=client_secrets.json

and get following error:

2012/12/15 15:51:33 assertion error:Invalid Key

Service account has all privileges and I have Cloud Storage enabled. What else can I do?

Eric Gavaletz

unread,
Apr 29, 2013, 2:38:36 PM4/29/13
to golan...@googlegroups.com
This is a very old thread and is probably too little help too late, but I think I know what is going on here.  You are passing in a PKCS12 key when a PEM file is required.  See the following comment from the jwt.Token struct (http://godoc.org/code.google.com/p/goauth2/oauth/jwt#Token):

"When obtaining a key from the Google API console it will be downloaded in a PKCS12 encoding. To use this key you will need to convert it to a PEM file. This can be achieved with openssl."

I hope this helps, and let me know if you encounter any further errors.
Reply all
Reply to author
Forward
0 new messages