Signing your Client Assertion

The next step is to generate your Client Assertion.
Sign the assertion in your own backend with a standard JWT library (for example jsonwebtoken for Node.js, PyJWT for Python). Never share your private key or paste it into an online tool.

  • Use the following JSON as the JWT header:
{
  "alg": "RS256",
  "typ": "JWT"
}
  • Use the following JSON as the JWT payload and replace the placeholders with your own information:
{
  "iss": "{{Company Url}}",
  "sub": "{{OAuth Client ID}}",
  "aud": "{{Safe Haven Environment}}",
  "iat": 1639806203,
  "exp": 1639809803
}

Company Url: Your Company URL

OAuth Client ID: Can be gotten from Safe Haven Dashboard

Safe Haven Environment: This is https://api.safehavenmfb.com ( for Production) and https://api.sandbox.safehavenmfb.com (for Sandbox).

Issued At (iat): the time you create the assertion, in epoch seconds. In code: Math.floor(Date.now() / 1000) (Node.js) or int(time.time()) (Python).

Expiry (exp): This is the timestamp of the date you want the client assertion jwt to expire.

Note: iat and exp are numeric epoch values (seconds), not strings. For example: 1639806203.

  • Sign the header and payload with your private key using the RS256 algorithm, in your own backend.

📘

Next Step:

The next step would be to generate your access token using the client assertion generated above. Click here to take you to the endpoint to generate your access token.