Integrate through OIDC

OpenID Connect (OIDC) is an authentication protocol, based on the OAuth 2.0 specifications. While OAuth 2.0 is about resource access and sharing, OIDC is all about user authentication.

MIRACL Trust is a standards-compliant OpenID Connect provider. You can use any OIDC Relying Party Library in order to integrate with MIRACL Trust. For a list of certified OpenID Connect Libraries, see https://openid.net/developers/certified/.

This page contains general information about integrating with the OpenID Connect implementation that MIRACL Trust exposes. For higher-level information about OIDC, see https://openid.net/connect/. For a full reference of all MIRACL Trust OIDC endpoints see the OIDC API Reference.

Quick reference

Setting Value
Configuration Discovery https://api.mpin.io/.well-known/openid-configuration
Issuer https://api.mpin.io
Authorization Endpoint https://api.mpin.io/authorize
WKS URI https://api.mpin.io/oidc/certs
Token Endpoint https://api.mpin.io/oidc/token
Userinfo Endpoint https://api.mpin.io/oidc/userinfo

View the full OIDC API reference

Configuration discovery

MIRACL Trust exposes OpenID Connect (OIDC) configuration discovery (https://api.mpin.io/.well-known/openid-configuration). This can be used to automatically configure your applications.

If you already have an OIDC implementation available in your application, you can easily configure it to use the MIRACL Trust service. Most clients are configured only with the issuer URL (https://api.mpin.io) and are automaticaly configured using configuration discovery.

Authorization endpoint

The user authorization endpoint for MIRACL Trust is https://api.mpin.io/authorize. A valid example of a generated authorization URI is:

https://api.mpin.io/authorize?client_id=wplkh5ertuboa&redirect_uri=https%3A%2F%2Fexample.com%2Flogin&response_type=code&scope=openid+email+profile

Here is a short description of the params in that URI:

  • client_id - The Client ID generated on application creation in the MIRACL Trust Console. (The one mentioned in the Get started section)
  • response_type - Determines what authorization processing flow will be used.
  • scope - The OIDC scopes that are used during authentication to authorize access to a user’s details (supported scopes).
  • redirect_uri - The place where your application will receive and process the response from MIRACL.
  • state - Used to maintain state between the request and the callback.

For a full list of supported parameters and their description see the OIDC API Reference

For more information, you can visit the Authorization Endpoint section in the OIDC Specification.

JWKS

JSON Web Key Set (JWKS) is a set of keys containing the public keys that should be used to verify the ID and access JSON Web Tokens (JWT) issued by MIRACL Trust. You can fetch the JWKS from https://api.mpin.io/oidc/certs.

Note that you should not hardcode the JWKS, as it is a subject of change. The OIDC client needs to fetch the JWKS dynamically in order to assure that the ID and access tokens are properly signed.

Token endpoint

The token endpoint https://api.mpin.io/oidc/token is used to exchange the authorization code for ID and access tokens. Requests to this endpoint need to be authenticated with the Client ID and Client Secret, which you received when creating an application in the management portal (Get Started). The token endpoint supports basic and post authentication.

For more details refer to OIDC API Reference

Userinfo endpoint

The userinfo endpoint https://api.mpin.io/oidc/userinfo returns information about the authenticated user. You must authenticate the request with an access token (returned from the token endpoint).

For more details refer to OIDC API Reference

OIDC Authentication flow

sequenceDiagram User -> Relying Party: Start Authentication Relying Party -> MIRACL Trust: Authentication request MIRACL Trust -> User: Authenticate user User -> Relying Party: Redirect with access code Relying Party -> MIRACL Trust: Exchange code for ID and access tokens User -> Relying Party: Authorize user

OIDC Samples

For samples of integrations with MIRACL Trust using OpenID Connect for different technologies using popular open-source libraries see https://github.com/miracl/oidc-samples/tree/master/samples.