Skip to main content

Edge-Cloud Authentication

Edge-cloud authentication uses Basic Authentication with site specific credentials. This method is ideal for edge devices that need to communicate directly to the Powernaut platform.

Getting Credentials​

You can obtain edge credentials for a site in two ways:

  1. During site creation
  2. Starting a new rotation

When creating a new site, the API response includes initial credentials:

import requests
import json

url = "https://api.powernaut.io/v1/connect/sites"

payload = json.dumps({
"location": {
"address": "Dok Noord, Gent, Belgium"
},
"supply_points": [
{
"grid_identifier": "EAN1234567890",
"direction": "bidirectional"
}
]
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <token>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

The response includes both the site details and its credentials.

{
id: "<uuid>",
// ... other site details
credentials: {
key: "<key>",
secret: "<secret>",
},
}
Portal

You can also perform this process directly in the Powernaut Portal. This provides a user-friendly interface for managing your sites and their credentials.

Using the Credentials​

Use Basic Authentication by including the credentials in the Authorization header. Concatenate the key and secret, from the response above, with a colon (:) and encode with Base64:

Authorization: Basic <base64(key:secret)>

Rotating Credentials​

The credential rotation process allows you to safely update credentials without service interruption:

  1. Start Rotation: Get new credentials while keeping existing ones active
  2. Complete Rotation: Deactivate old credentials once migration is complete
  3. (Optional) Cancel Rotation: Cancel the rotation process if needed
Credential Validity

During the rotation process, both the old and new credentials remain valid until the rotation is either completed or cancelled.

Deactivation Delay

Credentials that stop being valid — after completing a rotation, or after being revoked — can still be accepted for up to 30 seconds. Verified credentials are cached briefly, so treat a rotation as finished only once that window has passed rather than immediately after the call returns.

Starting Rotation​

To initiate a credential rotation, use the following endpoint:

import requests

url = "https://api.powernaut.io/v1/connect/sites/<uuid>/credentials/rotate?name=<string>"

payload = {}
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <token>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Completing Rotation​

Once you've updated your systems with the new credentials, complete the rotation to deactivate the old ones:

import requests

url = "https://api.powernaut.io/v1/connect/sites/<uuid>/credentials/rotate/complete?name=<string>"

payload = {}
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <token>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Cancelling Rotation​

If needed, you can cancel an ongoing rotation to keep using the original credentials:

import requests

url = "https://api.powernaut.io/v1/connect/sites/<uuid>/credentials/rotate/cancel?name=<string>"

payload = {}
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <token>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)