-
-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support BackendApplicationClient #152
Comments
Currently, no. However, since it does not require that much on the client side I've begun working on that and could do with your help trying it out on a real app. Please install oauthlib from master and then follow this example
|
Thanks for the help. Ive tried to install the oauthlib.oauth2 module using the below command - Then, while running my script (google_drive_p3.py) I got the following On Thu, Oct 16, 2014 at 5:19 AM, Ib Lundgren [email protected]
|
Forgot to mention it requires extra libraries not included in oauthlib by default due to their limited use. Please also install pycrypto and pyjwt |
Does requests-oauthlib supports using service account (BackendApplicationClient)?
Specifically, I would like to implement the following example were the authentication to google drive API is done via a service account (as the google apiclient lib is not supported for python3)
The below example uses apiclient and taken from https://developers.google.com/drive/web/service-accounts
import httplib2
import pprint
import sys
from apiclient.discovery import build
from oauth2client.client import SignedJwtAssertionCredentials
"""Email of the Service Account.
SERVICE_ACCOUNT_EMAIL = '@developer.gserviceaccount.com'
""" Path to the Service Account's Private Key file.
SERVICE_ACCOUNT_PKCS12_FILE_PATH = '/path/to/<public_key_fingerprint>-privatekey.p12'
def createDriveService():
"""Builds and returns a Drive service object authorized with the given service account.
Returns:
Drive service object.
"""
f = file(SERVICE_ACCOUNT_PKCS12_FILE_PATH, 'rb')
key = f.read()
f.close()
credentials = SignedJwtAssertionCredentials(SERVICE_ACCOUNT_EMAIL, key,
scope='https://www.googleapis.com/auth/drive')
http = httplib2.Http()
http = credentials.authorize(http)
return build('drive', 'v2', http=http)
Thanks,
Avi
The text was updated successfully, but these errors were encountered: