Reputation: 103
I am trying to access my google Spreadsheet using oauth2 using the gspread Python Library.I am new to Oauth2 and understand its benefits.But I am unable to use it.So far I have visited https://code.google.com/apis/console/ and generated CLIENT ID,SECRET and REDIRECT URI.
credentials = SignedJwtAssertionCredentials('[email protected]', SIGNED_KEY, scope)
According to the Gspread Docs I will need a SIGNED_KEY object.How do I get that?
An example will be very helpful.
Upvotes: 3
Views: 1367
Reputation: 3709
In the developer console, (https://console.developers.google.com) go to APIs & auth > Credentials and click Create new Client ID, then choose Service Account. Your browser should download a .p12 file. Now convert it to a PEM for GAE by doing this in the command line:
openssl pkcs12 -passin pass:notasecret -in privatekey.p12 -nocerts -passout pass:notasecret -out key.pem
openssl pkcs8 -nocrypt -in key.pem -passin pass:notasecret -topk8 -out privatekey.pem
You then have to move the PEM to your app directory, open it in your app code and then use it as the second arg in SignedJwtAssertionCredentials
Also make sure the app.yaml
libraries section includes pycrypto
libraries:
- name: pycrypto
version: "2.6"
I got this from someone's very helpful tutorial
Upvotes: 3