Welcome to our new developer portal! Use the "Ask" button to chat with our AI Agent.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

OAuth 2.0 アクセストークンを取得する

D1 APIs use the OAuth 2.0 JWT bearer flow (RFC 7523).

Your issuer backend signs a JSON Web Token (JWT) and exchanges it for a D1 access token.

Use the D1 access token to call D1 APIs.

Sequence Diagram

Prerequisite

  • Issuer certificate exchanged with Thales

  • Connectivity with mTLS in place

OAuth 2.0 JWT bearer flow between the issuer backend and the D1 backend.

Use the D1 access token

All issuer backend to D1 backend APIs require a D1 access token.

Send it in the Authorization header using the Bearer scheme:

Authorization: Bearer <Base64_Encoded_JWT>

The D1 access token is valid for 15 minutes.

Reuse the token until it expires.

Do not call /oauth2/token before every D1 API call.

JWT assertion

The /oauth2/token API expects a JWT assertion (RFC 7519).

Your issuer backend must generate a valid JWT and sign it.

You can:

  • Generate JWTs using an identity provider (for example, Keycloak).

  • Generate JWTs in your issuer backend.

In both cases, provision the public key used for signature verification in the D1 backend.

If you do not use an identity provider, generate the key pair and JWTs as described below.

Supported algorithms

Only JWTs signed with ES256 are supported (RFC 7518).

D1 uses asymmetric cryptography.

The D1 backend stores only public keys.

JWT format

A JWT consists of three parts separated by dots (.):

  • Header

  • Payload

  • Signature

Therefore, a JWT typically looks like the following: hhhhhhh.pppppppp.ssssssssss

The header part contains the algorithm to use and the type of token to generate.

kid is required.

The D1 backend uses it to select the correct public key.

Header example:

Payload

The payload supports the following claims:

Claim
Type
Required
Description

iss

string

Yes

Use the issuerId provided during D1 onboarding. D1 uses it to look up the provisioned public key. If you use an aggregator model, set this to the aggregatorId.

sub

string

Yes

Use the issuerId. (In case of aggregator, this value is equal to the aggregatorId.)

exp

integer

Yes

Expiration time in UTC epoch seconds. Maximum value is current time + 15 minutes.

aud

string

No

D1 authorization server base URL. Use the URL for your target environment: Sandbox = https://api.d1-stg.thalescloud.io, Production = https://api.d1.thalescloud.io.

D1 enforces the maximum expiration period. If exp exceeds the allowed window, D1 rejects the request.

Payload example

Signature

The signature is computed over the Base64URL-encoded header and payload.

The three JWT parts are joined using dots (.).

Generate the key pair

Use OpenSSL to generate a P-256 key pair:

Generate a private key for the issuer backend.

Protect it in your environment.

Generate a public key to provision in the D1 backend.

The issuer backend uses the private key to sign JWTs.

The D1 backend uses the public key (and its kid) to verify JWT signatures.

Share the public key and kid with the Thales Delivery Team during D1 Onboarding.

Generate the JWT

There are many ways to generate JWTs.

This example uses the jose Node.js library:

Example JWT output:

最終更新

役に立ちましたか?