To obtain the JWT, you’ll use our Token endpoint. You can access this with either our IMDS SDK, or via a JSON request. In this example, we’ll use our Python IMDS SDK to retrieve the JWT, and make an API call to an example server using the JWT to verify authenticity.

Getting the JWT

First, we’ll call the IMDS SDK to retrieve the JWT. Other languages are included for reference only.

When we run this, we’ll get our JWT printed out to console.

Making the API call

Next, we’ll use the JWT we retrieved in our API call to an example server.

Python
import requests
from salad_cloud_imds_sdk import SaladCloudImdsSdk, Environment

sdk = SaladCloudImdsSdk( base_url=Environment.DEFAULT.value, timeout=10000 )

result = sdk.metadata.get_container_token()

url = "https://my-server.com/api/v1/response"
headers = {'Content-Type': 'application/json'}
body = {"Example": "Example", "Another Example": "Another Example", "JWT": result}

response = requests.post(url, headers=headers, json=body)
print(response)

Now, when the server on the other end receives the API call, it can use the JWT to verify authenticity.