Python library for instantiating a client which authenticates to Maskinporten using private/public key pair.
Installation: "pip install git+https://github.com/samuelberntzen/maskinporten-client-python.git"
Usage:
import requests
from maskinporten_client.core.Client import MaskinportenClient
from maskinporten_client.utils.loaders import load_private_key_from_json
# Dev
private_key_json = load_private_key_from_json('private_key_dev.json') # Change path as needed
token_url = "https://ver2.maskinporten.no/token" # dev
audience = 'https://ver2.maskinporten.no/' # dev
issuer = <dev-integration-id> # dev
# Prod
private_key_json = load_private_key_from_json('private_key_prod.json') # Change path as needed
token_url = "https://maskinporten.no/token" # prod
audience = 'https://maskinporten.no/' # prod
issuer = <prod-integration-id> # porod
# Common
consumer_organization = <organization_id>
scopes = ['ks:fiks'] # or other scope defined in Maskinporten
maskinporten = MaskinportenClient(
token_url=token_url,
private_key_json = private_key_json,
scopes = scopes,
audience = audience,
issuer = issuer,
consumer_organization = consumer_organization
)
maskinporten.get_access_token()
- Free software: MIT license
- Documentation: https://maskinporten-client.readthedocs.io.
- TODO
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.