Verify an email credential

Tutorial on how to start the Credential verification process

Goal

This tutorial walks you through the process of verifying a credential using the Verifier API. The goal is to fetch the Auth Request URI for the selected credential type/template, present it in a user-friendly format (e.g., a QR code), and enable the user to scan it with their Wallet app. While the Wallet app's scanning process is outside the scope of this guide, we will cover everything necessary to prepare for successful verification.

Prerequisite:

  • Verifier API Base URL

  • Valid Verifier ApiKey

  • Valid role of Verifier Admin

  • Credential template ID, also known as the definitionId

Guide

1

Prepare credential template ID

The only dynamic variable required for the request is the Credential Template ID, also referred to as the definitionId or credentialId (commonly on the Issuer API side). This is typically a camelCase string representing the type of credential. For example, in the case of an email credential, the ID is emailCredential.

There are two common methods to locate this information:

  1. Retrieve the Credential ID from a Verifiable Credential:

    • Use the ID of the Issuer's Verifiable Credential to fetch its details via the Issuer API.

    • Call the "Fetch One Credential Offer" endpoint.

    • In the successful response, locate the credentialId field, which represents the Credential Template ID.

  2. Search in the List of Credential Types:

    • Use the Issuer API to list all credential types and their metadata by calling the appropriate endpoint.

    • Look for your desired credential type in the credentials_supported array.

    • The value you need is the id field in the corresponding data object.

2

Fetch verification information

To retrieve the authRequestURI for the credential, send a request to the Verifier API using the following steps:

curl --location --request POST '<VERIFIER_API_BASE_URL>/private/webapp/definitions/<DEFINITION_ID>/auth-requests' \
--header 'Authorization: Bearer <JWT_ACCESS_TOKEN>'
  • Replace the placeholder values in <VERIFIER_API_BASE_URL> and <JWT_ACCESS_TOKEN> with the actual API base URL and a valid access token for your setup.

  • For <DEFINITION_ID>, use the Credential Template ID you obtained in Step 1 of this guide.

Upon a successful response, you will receive a data object containing the authRequestURI field.

Important: The authRequestURI is not a standard URL that can be accessed through a browser. It is specifically designed to be readable by compatible Wallet apps for credential verification.

View full API documentation for endpoint used in this section

3

Present the verification URI

Once you have obtained the authRequestURI, present it in a format that the user can easily interact with. The most user-friendly option is to generate a QR code, which the user can scan with their Wallet app to initiate the verification process.

4

Monitor the verification status

After preparing the verification URI, you can track the status of the verification process by polling the Auth Status endpoint.

curl --location '<VERIFIER_API_BASE_URL>/private/webapp/auth-status' \
--header 'Authorization: Bearer <JWT_ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
    "correlationId": "<CORRELATION_ID>",
    "definitionId": "<DEFINITION_ID>"
}'

Along with the previously mentioned <VERIFIER_API_BASE_URL>, <JWT_ACCESS_TOKEN>, and <DEFINITION_ID>, you’ll need to include the <CORRELATION_ID> in the request. This value is returned from the response in the previous step, look for the correlationId value.

When you call the Auth Status endpoint, look for the status field in the response to monitor the progress. The status can indicate various stages:

  • created,

  • sent,

  • received,

  • verified,

  • error

View full API documentation for endpoint used in this section

Conclusion

By following this tutorial, you can successfully set up and manage the process of verifying a credential using the Verifier API. Fetching the authRequestURI, presenting it to users, and integrating Wallet app interactions are key steps in creating a seamless and secure verification workflow. While the Wallet app’s scanning process is beyond the scope of this guide, you now have a comprehensive understanding of how to use the Verifier API to facilitate credential verification.

Last updated