gcs-oauth2-boto-plugin is a Python application whose purpose is to behave as an auth plugin for the boto auth plugin framework for use with OAuth 2.0 credentials for the Google Cloud Platform. This plugin is compatible with both user accounts and service accounts, and its functionality is essentially a wrapper around the oauth2client package of google-api-python-client with the addition of automatically caching tokens for the machine in a thread- and process-safe fashion.
For more information about how to use this plugin to access Google Cloud Storage via boto in your application, see the GCS documentation.
Client Id and Client Secret fallback logic:
- .boto config, if not set
- environment variables (OAUTH2_CLIENT_ID and OAUTH2_CLIENT_SECRET), if not set
- CLIENT_ID and CLIENT_SECRET values set by SetFallbackClientIdAndSecret function.
Default locking mechanism used is threading.Lock. You can switch to using another locking mechanism by calling SetLock. Example:
SetLock(multiprocessing.Manager().Lock())
Before submitting any code, please run the tests (e.g., by running the following command from the root of this repository): python oauth2_plugin/test_oauth2_client.py