
Company News
Socket Has Acquired Secure Annex
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.
googleautoauth
Advanced tools
The Google API OAuth authorization process is very complex when running from command-line applications:
The tool must also periodically renew its authorization (whenever the expiration timestamp is reached).
This tool eliminates most of the steps:
Notice that now only one step needs to be implemented by the developer and only one step needs to be performed by the user.
The interactive flow is only necessary before the authorization file is initially created. All further requests will be done in the background.
Examples are for the YouTube API.
Build your client-identity::
client_id = 'abc'
client_secret = 'def'
cc = googleautoauth.authorize.build_client_credentials(client_id, client_secret)
Create a ClientManager object::
service_name = 'youtube'
service_version = 'v3'
scopes = [
'https://www.googleapis.com/auth/youtube.readonly',
]
# If this is `None` or omitted, the value will either be taken from `GAA_GOOGLE_API_AUTHORIZATION_REPO_PATH` or default to '~/.googleautoauth/<hash>', where hash is calculated from the client, service, and scope info.
filepath = None
cm = googleautoauth.client_manager.ClientManager(
service_name,
service_version,
cc,
scopes,
filepath=filepath)
Example usage::
# This will open the Google authorization portal in the browser if the
# authorization file doesn't already exist.
client = cm.get_client()
playlists = client.playlists()
request = \
playlists.list(
mine=True,
part='contentDetails')
result = request.execute()
# result['kind'] == 'youtube#playlistListResponse'
The ClientManager object can be cached but the client object returned by cm.get_client() can not. This call will automatically renew the API authorization as required.
A command-line tool (gaa_authorize) is provided to pre-create an authorization, for convenience. This can be used to ensure that no interactive authoriation is triggered from your program flow.
The tool can also be used to get a URL (-u) that can be used to manually get a token and to then manually register it locally (-t).
Example usage::
$ gaa_authorize "service name" "service version" "(client ID)" "(client secret)" --scope "(scope 1)" --scope "(scope 2...)" -u
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube.readonly&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=872980721285-bk2f9bk1r1j6tmo5k9ndbia4ef6nmi80.apps.googleusercontent.com&access_type=offline
$ gaa_authorize "service name" "service version" "(client ID)" "(client secret)" --scope "(scope 1)" --scope "(scope 2...)" -t 4/zXaFbTbevyn3zEizMiRdY0GVb3BM7XBUqbGdJhi8Fh8
GAA_WEBSERVER_PORT.To run the tests::
$ ./test.sh
The tests will require user interaction with the browser.
FAQs
Library to streamline Google authentication from the command-line.
We found that googleautoauth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.

Product
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.