google-api-python-client

How to Log User out of an App that uses Google OAuth2 Sign-In?

本秂侑毒 提交于 2019-12-02 01:24:45
I've implemented a Google OAuth2 login flow in my web-server app (using python/flask). My app redirects the user to Google, where they sign in with Google credentials and get directed back to my app. I'm having trouble deciding how to implement the Logout functionality for this app. I can clear the app's session cookies, but that doesn't log the user out of their Google a/c. So if the user hits Login after logging out, the redirect goes to Google and since the user is still signed into Google, they're automatically (without even being prompted to re-enter credentials) signed back in to my app.

How can I access user info on a domain without the domain administrator enabling API access?

霸气de小男生 提交于 2019-12-02 01:01:50
I have written an application that I have listed in the Google Marketplace. I am trying to get my app to use the Directory API (part of the Admin SDK). According to the documentation here: https://developers.google.com/admin-sdk/directory/v1/guides/prerequisites , this will require anyone who installs my app to enable API access. The only scope I need is: https://www.googleapis.com/auth/admin.directory.user.readonly Is there any way to access the above scope without requiring API access to be enabled? All I am ultimately trying to do is import users from a domain into my app so that they do

Unrecognized arguments using oauth2 and Google APIs

江枫思渺然 提交于 2019-12-01 20:47:56
问题 I'm using the Google API services in some scripts and having some problems. This error is something weird, but here we go. I have a script that is listing my Google Drive files. from apiclient import discovery from httplib2 import Http from oauth2client import file, client, tools SCOPES = 'https://www.googleapis.com/auth/drive.readonly.metadata' store = file.Storage('storage.json') creds = store.get() if not creds or creds.invalid: flow = client.flow_from_clientsecrets('client_secret.json',

Unifying OAuth handling between gdata and newer Google APIs

寵の児 提交于 2019-12-01 12:58:32
I'm working with the Google Contacts API and Google Calendar API in Python. The former is a GData API and the latter is a Google API... API, so while clients are available, they're each covered by separate clients -- here's GData , and Google API . The problem I'm running into working with these clients is that they both have their own way of dealing with OAuth2. The GData library provides gdata.gauth.token_to_blob(auth_token) and gdata.gauth.token_from_blob(auth_token) methods to translate auth tokens to/from strings to store in a database, while the google-api library provides a method on

How to use a service account with Google's python api and drive?

穿精又带淫゛_ 提交于 2019-12-01 12:23:20
I try to write python 2.7 script to upload a file into my personal google drive folder. After several problems I stuck know. This is my current error: NotImplementedError: PKCS12 format is not supported by the PyCrpto library. Try converting to a "PEM" (openssl pkcs12 -in xxxxx.p12 -nodes -nocerts > privatekey.pem) or using PyOpenSSL if native code is an option. I already tried to run this commands, as mentiod in this question and answer . openssl pkcs12 -in privatekey.p12 -nodes -nocerts > privatekey.pem openssl pkcs8 -nocrypt -in privatekey.pem -passin pass:notasecret -topk8 -out pk.pem my

How to use a service account with Google's python api and drive?

こ雲淡風輕ζ 提交于 2019-12-01 11:21:49
问题 I try to write python 2.7 script to upload a file into my personal google drive folder. After several problems I stuck know. This is my current error: NotImplementedError: PKCS12 format is not supported by the PyCrpto library. Try converting to a "PEM" (openssl pkcs12 -in xxxxx.p12 -nodes -nocerts > privatekey.pem) or using PyOpenSSL if native code is an option. I already tried to run this commands, as mentiod in this question and answer. openssl pkcs12 -in privatekey.p12 -nodes -nocerts >

Unifying OAuth handling between gdata and newer Google APIs

馋奶兔 提交于 2019-12-01 09:51:59
问题 I'm working with the Google Contacts API and Google Calendar API in Python. The former is a GData API and the latter is a Google API... API, so while clients are available, they're each covered by separate clients -- here's GData, and Google API. The problem I'm running into working with these clients is that they both have their own way of dealing with OAuth2. The GData library provides gdata.gauth.token_to_blob(auth_token) and gdata.gauth.token_from_blob(auth_token) methods to translate

How to properly define GAE's oauth2callback?

你说的曾经没有我的故事 提交于 2019-12-01 08:17:40
问题 The Using GAE / Decorators guide tells me that "you need to add a specific URL handler to your application to handle the redirection from the authorization server back to your application" : def main(): application = webapp.WSGIApplication( [ ('/', MainHandler), ('/about', AboutHandler), (decorator.callback_path, decorator.callback_handler()), ], debug=True) run_wsgi_app(application) Currently I am unable to properly set this up. As a result, I get and see the HTTP 302 callback response

How to do OAuth-requiring operations in a GAE cron job?

和自甴很熟 提交于 2019-12-01 06:02:01
This post is a followup to How to do OAuth-requiring operations in a GAE Task Queue? . As suggested by bossylobster in this post, I did try to hardcode the user_id in my script, but the cron task always fails: I can see it being triggered in the logs... 2013-05-31 14:20:00.879 /update 302 5ms 0kb AppEngine-Google; (+http://code.google.com/appengine) 0.1.0.1 - - [31/May/2013:11:20:00 -0700] "GET /update HTTP/1.1" 302 385 - "AppEngine-Google; (+http://code.google.com/appengine)" "myapp.appspot.com" ms=6 cpu_ms=0 cpm_usd=0.000043 queue_name=__cron task_name=... app_engine_release=1.8.0 instance=.

How to do OAuth-requiring operations in a GAE cron job?

两盒软妹~` 提交于 2019-12-01 03:08:10
问题 This post is a followup to How to do OAuth-requiring operations in a GAE Task Queue? . As suggested by bossylobster in this post, I did try to hardcode the user_id in my script, but the cron task always fails: I can see it being triggered in the logs... 2013-05-31 14:20:00.879 /update 302 5ms 0kb AppEngine-Google; (+http://code.google.com/appengine) 0.1.0.1 - - [31/May/2013:11:20:00 -0700] "GET /update HTTP/1.1" 302 385 - "AppEngine-Google; (+http://code.google.com/appengine)" "myapp.appspot