Skip to main content

Health Wallet SSO

To allow for a seamless integration between your UI and First Dollar’s UI, there needs to be an authentication integration between the two platforms. The end result of this integration is that a user, logged into your portal, can be redirected to their associated First Dollar dashboard without needing to log in again.


SAML - XML-based authentication passing technique


Enabling SSO requires the following steps:

  • From within your web application, your user requests a redirect to First Dollar's web application. The user must already be authenticated on your web application.
  • Your server generates and signs SAML XML.
  • The user is sent to with a form post containing the signed SAML XML in the post body.
  • First Dollar validates SAML signature (with a public key), and validates the userId from your system
  • User is logged in with a userId property from First Dollar, and is redirected to First Dollar's web application

This SSO integration also depends on a mapping from a globally unique user ID property to an associated First Dollar user ID.

For API based partners, you can store the id field that is returned from the createIndividual API endpoint to serve as this shared user ID property.

For file based partners, a mapping of a unique user ID in your system can be made to a First Dollar unique user ID as a part of the ingestion of your enrollment file.


Generate SAML Signing Key

On a linux machine, run the following command:

openssl req -x509 -nodes -sha256 -days 3650 -newkey rsa:2048 -keyout
fd_saml_private_signing.key -out fd_saml_signing_certificate.crt

Move fd_saml_private_signing.key to a secure location.

Please attach fd_saml_signing_certificate.crt in an email and send it to This allows us to validate the signed SAML XML requests you send to us. This file is not private so it's okay to send as a plain attachment via email.

Generating the SAML XML

As the Identity Provider, you must generate and sign a SAML Response XML. This unsigned XML should look like the following template:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<saml2p:Response xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
ID="{samlResponseId}" IssueInstant="{samlIssueInstant}"
<saml2:Issuer xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
ID="{samlAssertionId}" IssueInstant="{samlIssueInstant}"
<saml2:Conditions NotBefore="{samlBeginTimestamp}"
<saml2:AuthnStatement AuthnInstant="{samlIssueInstant}">

This template should be filled in with the following template variables, all properly XML escaped. Below are the variable names and an example value:

 // A unique uuid
samlResponseId: '7a40ec03-5c75-45fe-9db7-9ef74f928e48'

// A unique uuid
samlAssertionId: 'c3f5bbbe-6fc3-47a5-aad5-e57160dee5bd'

// The timestamp when this SAML XML was generated
samlIssueInstant: '2022-01-27T15:04:42+0000'

// URL of the service that issued this SAML XML
samlIssuerId: ''

// The userId from your system of the user that we’d like to authenticate.

// When this SAML token expires, we recommend {samlIssueInstant} + 5min
samlExpirationTimestamp: '2022-01-27T15:09:42+0000'

// When this SAML token starts being valid, we recommend {samlIssueInstant} - 10s
samlBeginTimestamp: '2022-01-27T15:04:32+000'

Signing the SAML XML

Once the SAML XML has been generated, it must be signed before sending it to First Dollar. Specifically, the <saml2:Assertion> block is signed.

We support as the signature algorithm, and as the canonicalization algorithm. This will generate the following XML, which should be added as a child of the <saml:Response> entry.

<ds:CanonicalizationMethod Algorithm=""/>
<ds:SignatureMethod Algorithm=""/>
<ds:Reference URI=<!-- should reference the saml2:Assertion block >>
<ds:Transform Algorithm=""/ >
<ds:Transform Algorithm="" />
<ds:DigestMethod Algorithm="" />
<!-- generated by signing the saml:Assertion block -->
<!-- generated by signing the saml:Assertion block -->
<ds:Signature xmlns:ds="">
<!-- contents of `fd_saml_signing_certificate.crt` generated above -->

Note that most languages have libraries which handle XML signing / SAML out of the box.

Send the user to First Dollar

After generating the signed SAML XML, send the user to with a form post containing the signed SAML XML in the post body.

First Dollar's server will take the SAML XML provided and verify it. It will run the following steps and return an error if any failures occur:

  • Validate the signature on the SAML XML
  • Validate the provided userId from your system maps to a valid First Dollar userId

Upon successful verification, First Dollar will redirect the user to our UI.

Once FD has verified that the SAML XML was signed appropriately and that First Dollar has a valid User for the given userId from your system, FD will generate a JWT token and redirect the user to a page which takes the newly generated JWT token. First Dollar also sets the appropriate cookies so that the User can access their First Dollar dashboard.