Skip to content

An easy-to-use handler for obtaining valid authentication tokens within the SALTED architecture.

License

Notifications You must be signed in to change notification settings

SALTED-Project/TokenHandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SALTED - Token Handler

TokenHandler is a Python class intended to ease the authentication process within SALTED. It is aimed at partners working on WP2 and WP4 activities, but may also be of use to external users developing DET components.

Installation

Install as package in your Python 3 environment:

pip install git+https://github.com/SALTED-Project/TokenHandler.git

Usage

from tokenhandler.handler import TokenHandler
import requests

# instantiate TokenHandler
th = TokenHandler("https://auth.salted-project.eu/realms/SALTED/protocol/openid-connect/token", <your keycloak client ID>, <your keycloak client secret>)

# obtain valid token
token = th.get_token()

# test token with scorpio broker
headers = {
    'Authorization' : 'Bearer '+ token,
    'Accept': 'application/ld+json'
}
r = requests.get("https://context-broker.salted-project.eu/ngsi-ld/v1/entities?type=Organization",headers=headers)
print(r.json())

About

An easy-to-use handler for obtaining valid authentication tokens within the SALTED architecture.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages