Skip to content

Latest commit

 

History

History
73 lines (50 loc) · 2.25 KB

README.rst

File metadata and controls

73 lines (50 loc) · 2.25 KB

maskinporten_client

Documentation Status

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()

Features

  • TODO

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.