Skip to main content

Authenticate

The Platform API is served over TLS and authenticated with a bearer token. Coordinate the endpoint and a token for your integration through your Greenroom engagement.

Configure two values, conventionally via environment variables:

VariableMeaning
PLATFORM_ENDPOINTHost and port of the Platform endpoint, e.g. platform.example.greenroomrobotics.com:443
PLATFORM_TOKENBearer token presented on every request

Open a secure channel that presents the token on each call:

auth.py
import os
import grpc

def create_channel() -> grpc.Channel:
call_creds = grpc.access_token_call_credentials(os.environ["PLATFORM_TOKEN"])
channel_creds = grpc.composite_channel_credentials(
grpc.ssl_channel_credentials(),
call_creds,
)
return grpc.secure_channel(os.environ["PLATFORM_ENDPOINT"], channel_creds)
Token expiry and self-signed endpoints

If a token expires or is rejected, calls fail with the gRPC status UNAUTHENTICATED — refresh the token and rebuild the channel (see Error handling). Connecting to a vessel on a private network with a self-signed certificate needs extra TLS setup — see Connecting to a vessel.

Next

Make your first call in the Quickstart.