Guest organisation
OCPI
Learn reference
Guest organisation
OCPI
Learn reference

CPO and eMSP exchange credentials

Technical · 3 min

OCPI 2.1.1, 2.2.1 and 2.3.0

Showing OCPI 2.2.1. Physical and billing-system events are authored examples.

Part of the lesson OCPI charging session lifecycle

Step 2 of 4 · Roaming connection setup
credentialseMSPsendsCPOreceives
credentialsCPOreceiveseMSPsends
Legend

The line follows the selected step. Actor dots identify the parties; they show no conformance verdict.

Step 2 of 4 · Paused

Selected step

All 2 actors

CPO · eMSP

Selected exchange

Still using token A, the eMSP POSTs CREDENTIALS_TOKEN_B to the credentials endpoint it found in the version details. The CPO stores token B for its own requests to the eMSP and returns CREDENTIALS_TOKEN_C. Each token works in one direction: B for the CPO calling the eMSP, C for the eMSP calling the CPO.

eMSP → CPO · credentials

Sources (4)
"The Sender starts the registration process, retrieves the version information and details (using `CREDENTIALS_TOKEN_A` in the HTTP Authorization header). The Sender generates a unique credentials token: `CREDENTIALS_TOKEN_B`, sends it to the Receiver in a POST request to the `credentials` module of the Receiver. The Receiver stores `CREDENTIALS_TOKEN_B` and uses it for any requests to the Sender Platform, including the version information and details. The Receiver generates a unique credentials token: `CREDENTIALS_TOKEN_C` and returns it to the Sender in the response to the POST request from the Sender."OCPI 2.2.1 Credentials chapter · #credentials_registration"After the credentials exchange has finished, the Sender SHALL use `CREDENTIALS_TOKEN_C` in future OCPI request to the Receiver Platform."OCPI 2.2.1 Credentials chapter · #credentials_registrationtoken · string(64) · cardinality 1: The credentials token for the other party to authenticate in your system. It should only contain printable non-whitespace ASCII characters, that is, characters with Unicode code points from the range of U+0021 up to and including U+007E. url · URL · cardinality 1: The URL to your API versions endpoint. roles · CredentialsRole · cardinality +: List of the roles this party provides.OCPI 2.2.1 Credentials chapter · #credentials_credentials_object"After the literal 'Token', there SHALL be one space, followed by the 'encoded token'. The encoded token is obtained by encoding the credentials token to an octet sequence with UTF-8 and then encoding that octet sequence with Base64 according to https://datatracker.ietf.org/doc/html/rfc4648#section-4[RFC 4648]."OCPI 2.2.1 Transport and format chapter · #transport_and_format_authorization_header
Why this matters

The parties exchange credentials tokens to authenticate later requests between their platforms.

Explore the credentials module →

No sandbox run sends this exchange, so there is nothing to run here.

Test this flow

Test this flow runs against an eMSP endpoint you have registered.