Retrieve a List of SAML Certificates and Expiration Dates

Problem statement

This article will explain how to create a report in Auth0 that shows a list of certificates for SAML connections and their set expiration dates.

Solution

The SAML certificates and their expiration date can be retrieved from the GET /api/v2/connections endpoint of the Management API. Including ?strategy=samlp in the query will get a list of all the SAML connections, and within the ‘options’ object there will be the expiration of each connection’s certificate.

Here is an example CURL command that will return just the options objects from each of the SAML connections:

curl -L 'https://{auth0_domain}/api/v2/connections?strategy=samlp&fields=options&include_fields=true' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {token}'

Here is an example of the options object from a SAML connection:

    "options": {
      "cert": "-----BEGIN CERTIFICATE-----*****************-----END CERTIFICATE-----",
      "expires": "2031-01-11T23:53:50.000Z",
...rest of options
    },