Update via refresh token
Credential update is offered as a closed preview feature and is not generally available yet. Its behavior may change in a way that breaks existing integrations before it becomes generally available. To enable it on your tenant, contact us.
Overview
In this mechanism the holder app silently obtains a new access token for a credential it already holds, by presenting a DPoP-bound refresh token to the Token endpoint. It then uses that access token to request the credential again. The holder does not authenticate again, and nobody needs to share a new credential offer.
The request can be a conditional update, where MATTR VII only issues a new credential when one is due, or a forced update, where MATTR VII always issues one. Either way the new credential is issued into the bundle the holder already has, so it keeps its credentialBundleId and credentialReferenceId.
For example, when a holder moves house and updates their address with the licensing authority, the authority forces an update for the holder's mobile driver's license (mDL). The next time the holder's wallet checks for an update, it receives an mDL with the new address and replaces the old one. The holder does not sign in again or claim a new offer.
This page describes what your credential configuration needs, and what MATTR VII does with each request. To build the wallet side with the MATTR Holder SDKs, see Credential update in the holding documentation.
Requirements
MATTR VII issues a refresh token alongside a credential when all of the following are true:
- The credential configuration allows refresh: Set
refreshPolicy.enabledtotrueon the mDocs credential configuration. When an access token covers several credential configurations, every one of them must allow refresh. - The wallet uses DPoP: The wallet includes a DPoP (Demonstrating Proof-of-Possession) proof when it calls the Token endpoint.
The refreshPolicy settings are only available via the MATTR VII API for now. Support in the MATTR Portal is coming in a later release.
This works for credentials issued through either the Authorization Code flow or the Pre-authorized Code flow.
DPoP binds the refresh token to the wallet's key material, so only the wallet that claimed the credential can use it. When the wallet also uses Wallet Attestation, the refresh token is bound to the attested wallet instance as well. See Refresh token binding.
To request the updated credential without asking the user to unlock the credential's device key, a wallet proves possession of that key with the attestation proof type (a key-attestation+jwt, as defined in OpenID4VCI 1.0, Appendix D.1) rather than the jwt proof type. MATTR VII advertises the attestation proof type with ES256 in its issuer metadata for every mDocs credential configuration, and the MATTR Holder SDKs use it automatically.
Refresh tokens
- When the requirements are met, the Token endpoint returns a
refresh_tokenalongside the access token. - When the wallet presents the refresh token to the Token endpoint with
grant_typeset torefresh_tokenand a new DPoP proof, MATTR VII returns a new access token. The refresh token is not rotated: the response carries the same refresh token, and the wallet keeps using it for every later update. - When the grant binds claim sets, the scope is preserved across refresh. The token response repeats the same
authorization_details, and the wallet sendscredential_identifieron the credential request to say which of its credentials of that type it is updating.
Refresh tokens do not expire. They remain valid until they are revoked. MATTR VII rejects a refresh request with invalid_grant when:
- The refresh token has been revoked, for example because you unlinked the credential bundles it covers.
- The DPoP proof is signed with a different key from the one the refresh token is bound to.
- A credential configuration covered by the grant no longer has
refreshPolicy.enabledset totrue.
A wallet that receives invalid_grant cannot update the credential. The holder needs to claim it again.
Credential data
When a credential configuration allows refresh, every credential issued for it, including the first one, is built only from data that MATTR VII can resolve again later:
- The claims mapped in the credential configuration.
- New validity dates, calculated at issuance.
- Claims persisted against the user and its claim sets.
- Any configured Claims source, which receives the same
credentialBundleIdandcredentialReferenceIdit received at first issuance.
Ephemeral claims are not used for these credentials, at first issuance or on update. This covers claims returned by the holder's authentication provider or your Interaction hook, claims supplied on a credential offer, and claims from identity verification. Persist any claim you need against the user, for example with claimsToPersist, or return it from a Claims source.
The credential that the update supersedes is not revoked automatically. It remains valid until it expires. See Credential data.
How it works
- The wallet calls the Token endpoint with an authorization code or a pre-authorized code and a DPoP proof.
- MATTR VII returns an access token and a refresh token.
- The wallet calls the Credential endpoint and receives the credential, together with its
credential_data_set_id,credential_reference_idandcredential_bundle_id. The wallet stores all of them alongside the credential. - Later, the wallet calls the Token endpoint again with the refresh token and a new DPoP proof.
- MATTR VII validates the refresh token and the DPoP proof, and returns a new access token along with the same refresh token.
- The wallet calls the Credential endpoint with the new access token. MATTR VII either issues a new credential into the same bundle, or responds with
204 No Contentwhen a conditional update finds the credential is still current.
Conditional update
In a conditional update, the wallet sends the credential_data_set_id of the credential it holds on the credential request. The credential data set ID is the credential version: a hash that MATTR VII calculates from the credential's claims each time it issues one, and records against the credential bundle as its latest version. See Credential version.
MATTR VII issues a new credential, and returns it with its new credential_data_set_id, when either of the following is true:
- The version the wallet sent does not match the latest version recorded for the bundle.
- An update has been requested for the bundle since that version was issued. An update is requested when you force an update or create a pre-authorized update offer against the bundle.
Otherwise MATTR VII decides based on the claims check interval:
- Within the interval: MATTR VII responds with
204 No Contentwithout resolving the credential's claims. - After the interval has passed: MATTR VII resolves the credential's claims again and recalculates the version. It issues a new credential only when the recalculated version differs from the one the wallet sent. When it matches, MATTR VII responds with
204 No Contentand the interval starts again.
A conditional update never issues a new credential just because time has passed. When the claims have not changed, the wallet keeps the credential it holds, including its validity period. To issue a credential with a new validity period, for example before the current one expires, force an update for it.
Conditional update is well suited to:
- Keeping credential data current: A change in your system of record reaches the wallet on its first check after the claims check interval has passed, without any action from your backend.
- Efficient Claims source usage: MATTR VII calls your Claims source at most once per interval for a bundle when nothing has changed, and when it is going to issue.
- Holder-driven checks: A wallet can check for updates as often as it likes, for example on every launch. When you force an update, the wallet receives the new credential on its next check.
Claims check interval
The claims check interval sets how often MATTR VII checks a credential's claims again to detect a change. It controls how quickly a change to the claims reaches the wallet, which is also limited by how often the wallet checks for updates. Configure it with refreshPolicy.credentialClaimsCheckInterval on the credential configuration:
{
"type": "org.iso.18013.5.1.mDL",
"refreshPolicy": {
"enabled": true,
"credentialClaimsCheckInterval": {
"days": 7
}
}
}The interval accepts any combination of years, months, weeks, days, hours, minutes and seconds. When it is not specified, a default of 7 days applies. MATTR VII only accepts a custom interval when credential update is enabled on your tenant, and ignores it otherwise. It runs from the later of when the bundle's latest version was issued and when MATTR VII last checked its claims.
A shorter interval delivers claim changes sooner, at the cost of more calls to your Claims source. When you know the data has changed, you do not need to wait for the interval. Force an update instead.
Forced update
In a forced update, the wallet requests the credential without sending credential_data_set_id. MATTR VII always issues a new credential, rebuilding the MSO with a new validity period and the latest data.
You can also force the next conditional update to issue, by marking a credential as requiring an update from your backend. See Forcing credential updates.
Whether an update happens silently, and when, depends on the holder app. Issuers should assess holder capabilities and security policies before allowing refresh on a credential configuration.
Integrity protection
To protect the integrity of requests that use DPoP proofs, MATTR VII supports validating the content digest of the HTTP request payload through the DPoP proof. This applies to the Credential endpoint, and to the Token endpoint when the wallet exchanges an authorization code or a pre-authorized code.
Wallets can include an optional htcd (HTTP Content Digest) claim in their DPoP proof. When the htcd claim is provided:
- The claim must contain the content digest of the HTTP request payload.
- The value must use the HTTP Content-Digest header format, for example
sha-256=:${base64(sha256(requestBody))}: - If a
Content-Digestheader is also present in the HTTP request, MATTR VII compares both values to ensure they match.
The following is an example DPoP proof with the htcd claim:
{
"typ":"dpop+jwt",
"alg":"ES256",
"jwk": {
"kty":"EC",
"x":"l8tFrhx-34tV3hRICRDY9zCkDlpBhF42UQUfWVAWBFs",
"y":"9VE4jf_Ok_o64zbTTlcuNJajHmt6v9TDVrU0CdvGRDA",
"crv":"P-256"
}
}
.
{
"jti":"-BwC3ESc6acc2lTc",
"htm":"POST",
"htu":"https://server.example.com/token",
"htcd": "sha-256=:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=:",
"iat":1562262616
}If the htcd claim does not match the request payload, the request is rejected.
How would you rate this page?
Last updated on