Dapla Auth Client

PyPI Status Python Version License

Documentation Tests Coverage Quality Gate Status

pre-commit Black Ruff Poetry

Features

  • Detects Dapla environment, service, and region via environment variables

  • Retrieves current Dapla region (e.g., checks for DAPLA_LAB)

  • Reads Kubernetes service-account token from filesystem

  • Exchanges Kubernetes token for Keycloak token in Dapla Lab

  • Overrides Google-Auth refresh handler to use custom token fetch logic

  • Fetches Google ADC credentials

Requirements

  • Python >3.8 (3.10 is preferred)

  • Poetry, install via curl -sSL https://install.python-poetry.org | python3 -

Installation

You can install Dapla Auth Client via pip from PyPI:

pip install dapla-auth-client

Usage

# This code snippet demonstrates how to use the Dapla Auth Client to fetch a personal token.

from dapla_auth_client import AuthClient

print(AuthClient.fetch_personal_token())

Contributing

Contributions are very welcome. To learn more, see the Contributor Guide.

License

Distributed under the terms of the MIT license, Dapla Auth Client is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Credits

This project was generated from Statistics Norway’s SSB PyPI Template.