Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 1.05 KB

File metadata and controls

25 lines (17 loc) · 1.05 KB
description
A description on how to retrieve an authorization token using unity-sds-client.

Getting a Unity Token

In order to authorize some actions in the Unity system, you need to provide an access token. This is needed when using certain APIs and when authorizing the STAC Browser UI to view data files. Over time we expect these instances to reduce for most common interactions with the system.

Use the following Python code to get a token that you can paste into API calls or into STAC Browser when it requests you token. It uses the unity-sds-client library.

import requests

from unity_sds_client.unity import Unity
from unity_sds_client.unity import UnityEnvironments

s = Unity(UnityEnvironments.PROD)
token = s._session.get_auth().get_token()

print("Here's your token:\n" + token)

Also see: https://github.com/unity-sds/unity-example-application/blob/main/retrieve_Unity_Token.ipynb