Skip to main content

girder-cli-oauth-client

A Python library for performing OAuth login to a Girder 4 (Django) server.

Description

This provides support for authenticating with Girder 4 servers, using the OAuth2.0 Authorization Code Grant with PKCE flow and out-of-band redirection.

Usage

  • Install the library:

    pip install girder-cli-oauth-client
    
  • Instantiate an OauthClient with your application-specific configuration:

    from girder_cli_oauth_client import GirderCliOAuthClient
    
    oauth_client = GirderCliOAuthClient(
        'http://localhost:8000/oauth/',
        '1ohsuyWIx9fEsJhmAH2AWGNUqd8Wsd7LHyongtVy',
        ['identity'],
    )
    
  • Call login when it's time to start a login flow:

    oauth_client.login()  # open the browser to login and wait for a code
    
  • At the start of every application start, unconditionally call maybe_restore_login, to attempt to restore a login state; this will no-op if no login is present.

    oauth_client.maybe_restore_login()
    
  • Include these headers with every API request:

    requests.get('http://localhost:8000/api/users/me', headers=oauth_client.auth_headers)
    
  • Call logout to clear any active login:

    oauth_client.logout()
    

Example app

This repository comes bundled with an example application. Run it with:

git clone https://github.com/girder/girder-cli-oauth-client.git
pip install -e '.[dev]'
cd example
python cli.py login
python cli.py me

Metadata

Release files for girder-cli-oauth-client 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for girder-cli-oauth-client 0.4.0
File Size Uploaded
girder-cli-oauth-client-0.4.0.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for girder-cli-oauth-client 0.4.0
File Interpreter ABI Platform
girder_cli_oauth_client-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.8 kB

Release files / girder-cli-oauth-client-0.4.0.tar.gz

Download URL girder-cli-oauth-client-0.4.0.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
479dbb7d4e5b2533ec673da5b16017f7cc8a7223b24558f1e1e9922247f5401a
BLAKE2b-256 checksum
How to use checksums
43fd979811b94590efe4fc82c6483ac01b469bd62623fc8aa1ba38bcfa42fd68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

Release files / girder_cli_oauth_client-0.4.0-py3-none-any.whl

Download URL girder_cli_oauth_client-0.4.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64d953371debf6eb2db179e6a5c02bdc78d23ca055a19d433d58822a1631821b
BLAKE2b-256 checksum
How to use checksums
313c59dc9da87f132a3acdc484d8a4d749a503d041dae57ab23dff3a20ef0a50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page