|
1 | | -# Connect Asgardeo as an OIDC attribute provider for verifiable credentials (VC) with MATTR |
2 | | - |
3 | | -Verifiable credentials are digital versions of paper-based credentials that you can securely store in a digital wallet. These credentials can be cryptographically verified, making them tamper-evident (provides clear evidence if credentials were tampered) and more secure than their physical counterparts. |
4 | | - |
5 | | -If you or your organization already manage user accounts with an OpenID Connect (OIDC) provider (like Asgardeo), you can use OIDC login to share user attributes and issue verifiable credentials. |
6 | | - |
7 | | -This tutorial explains how to connect Asgardeo as an OpenID Connect (OIDC) attribute provider to issue verifiable credentials using [MATTR](https://mattr.global/){:target="_blank"}, a platform for decentralized identity management. |
8 | | - |
9 | | -The high-level steps include, |
10 | | - |
11 | | -1. Configuring MATTR to connect to Asgardeo with OpenID Connect. |
12 | | -2. Issuing verifiable credentials to the MATTR Wallet. |
13 | | -3. Verifying credentials presented by the Wallet holder. |
14 | | - |
15 | | -## Step 1: Set up your Asgardeo organization |
16 | | - |
17 | | -The steps in this section configures your Asgardeo organization to connect with MATTR. |
18 | | - |
19 | | -### Step 1.1: Register an OIDC application in Asgardeo |
20 | | - |
21 | | -To register your application in Asgardeo: |
22 | | - |
23 | | -1. On the [Asgardeo Console](https://console.asgardeo.io/){: target="_blank"}, go to **Applications** > **New Application** and select **Traditional Web Application**. |
24 | | - |
25 | | -2. Create an application by providing the following details: |
26 | | - |
27 | | - - Provide a name for the application. |
28 | | - - Select the **OpenID Connect** protocol. |
29 | | - - Add a placeholder value for the **Authorized redirect URL**. |
30 | | - |
31 | | - !!! note |
32 | | - |
33 | | - You can update this later once you configure MATTR. |
34 | | - |
35 | | -3. Click **Register** to complete the registration. |
36 | | - |
37 | | -4. Take note of the following from the registered application, which you will need later when configuring MATTR: |
38 | | - |
39 | | - - From the **Protocol** tab, the **client ID** and **client secret**. |
40 | | - - From the **Info** tab, the **Token** URL. |
41 | | - |
42 | | - !!! note |
43 | | - |
44 | | - The sections below refers to these values as `<ASGARDEO_CLIENT_ID>`, `<ASGARDEO_CLIENT_SECRET>`, and `<ASGARDEO_TOKEN_URL>` respectively. |
45 | | - |
46 | | -### Step 1.2: Share user attributes with the application |
47 | | - |
48 | | -To issue verifiable credentials, your application needs access to user attributes. The following steps configure Asgardeo to share these attributes with your application. |
49 | | - |
50 | | -1. On the Asgardeo Console, go to **Applications** and select the created OIDC application. |
51 | | - |
52 | | -2. Navigate to its **User Attributes** tab, expand a specific scope and select the required user attributes (for example, `email`, `given_name`, `family_name`, and `birthdate`) as **Mandatory**. |
53 | | - |
54 | | - !!! note |
55 | | - |
56 | | - The attributes you want to receive from Asgardeo during OIDC authentication must belong to a scope. If you want to receive custom attributes, make sure to add them to a scope. Learn more about [OIDC scopes]({{base_path}}/guides/users/attributes/manage-scopes/#how-to-request-scope-to-request-user-attributes). |
57 | | - |
58 | | -3. Click **Update** to save the changes. |
59 | | - |
60 | | -### Step 1.3: Create a user account in Asgardeo |
61 | | - |
62 | | -You need an Asgardeo user account to log in to the application. If you don't have one, create it by following the steps below: |
63 | | - |
64 | | -1. On the Asgardeo Console, go to **User Management** > **Users**. |
65 | | - |
66 | | -2. Click **Add User** > **Single User**. |
67 | | - |
68 | | -3. Complete the wizard to create a new user. |
69 | | - |
70 | | -This user will log in to Asgardeo to receive verifiable credentials from MATTR. |
71 | | - |
72 | | -## Step 2: Set up your MATTR environment |
73 | | - |
74 | | -The steps in this section configures your MATTR environment to connect with Asgardeo. |
75 | | - |
76 | | -### Step 2.1: Create a MATTR account |
77 | | - |
78 | | -To create an account, |
79 | | - |
80 | | -1. Navigate to [MATTR](https://mattr.global/){: target="_blank"} and sign up. |
81 | | - |
82 | | -2. Take note of your **client ID**, **client secret**, **tenant URL**, **auth URL**, and **audience**. |
83 | | - |
84 | | - !!! note |
85 | | - |
86 | | - The sections below refers to these values as `<MATTR_CLIENT_ID>`, `<MATTR_CLIENT_SECRET>`, `<MATTR_TENANT_URL>`, `<MATTR_AUTH_URL>` and `<MATTR_AUDIENCE>` respectively. |
87 | | - |
88 | | -### Step 2.2: Get an access token for MATTR |
89 | | - |
90 | | -Obtain an access token for the MATTR tenant by sending the following request: |
91 | | - |
92 | | -```bash |
93 | | -curl -i -X POST "<MATTR_AUTH_URL>/oauth/token" \ |
94 | | --H "Content-Type: application/json" \ |
95 | | --d '{ |
96 | | - "client_id": "<MATTR_CLIENT_ID>", |
97 | | - "client_secret": "<MATTR_CLIENT_SECRET>", |
98 | | - "audience": "<MATTR_AUDIENCE>", |
99 | | - "grant_type": "client_credentials" |
100 | | -}' |
101 | | -``` |
102 | | - |
103 | | -!!! note |
104 | | - |
105 | | - The sections below refers to the received access token as `<MATTR_BEARER_TOKEN>`. |
106 | | - |
107 | | -### Step 2.3: Configure MATTR authentication provider |
108 | | - |
109 | | -Set up a authentication provider in MATTR VII to connect with Asgardeo. See the MATTR documentation on [authentication providers](https://learn.mattr.global/docs/issuance/authorization-code/authentication-provider/overview){: target="_blank"} for more details. |
110 | | - |
111 | | -```bash |
112 | | -curl -i -X POST "<MATTR_TENANT_URL>/v1/users/authentication-providers" \ |
113 | | --H "Authorization: Bearer <BEARER_TOKEN>" \ |
114 | | --H "Content-Type: application/json" \ |
115 | | --d '{ |
116 | | - "url": "<ASGARDEO_TOKEN_URL>", |
117 | | - "scope": ["openid", "profile", "email"], |
118 | | - "clientId": "<ASGARDEO_CLIENT_ID>", |
119 | | - "clientSecret": "<ASGARDEO_CLIENT_SECRET>", |
120 | | - "tokenEndpointAuthMethod": "client_secret_post", |
121 | | - "staticRequestParameters": { |
122 | | - "prompt": "login", |
123 | | - "maxAge": 10000 |
124 | | - } |
125 | | -}' |
126 | | -``` |
127 | | - |
128 | | -Replace the placeholders with your actual values: |
129 | | - |
130 | | -- `<ASGARDEO_TOKEN_URL>`: The token endpoint from your Asgardeo application. |
131 | | -- `<ASGARDEO_CLIENT_ID>`: The client ID from your Asgardeo application. |
132 | | -- `<ASGARDEO_CLIENT_SECRET>`: The client secret from your Asgardeo application. |
133 | | - |
134 | | -### Step 2.4: Create issuer certificates |
135 | | - |
136 | | -These certificates let MATTR securely sign verifiable credentials. Any credential issued using these certificates can be trusted by users’ mobile wallets. |
137 | | - |
138 | | -1. Create issuer certificates to securely sign verifiable credentials that users can store and use in mobile wallets |
139 | | - |
140 | | -#### Create an IACA (Issuer Authority Certificate Authority) |
141 | | - |
142 | | -The IACA acts as the root authority for your issuer. You’ll use it to sign all credentials. To create an IACA, run the following command: |
143 | | - |
144 | | -```bash |
145 | | -curl -i -X POST '<MATTR_TENANT_URL>/v2/credentials/mobile/iacas' \ |
146 | | --H 'Authorization: Bearer <BEARER_TOKEN>' \ |
147 | | --H 'Content-Type: application/json' \ |
148 | | --d '' |
149 | | -``` |
150 | | - |
151 | | -!!! note |
152 | | - |
153 | | - The section below refers to the `id` parameter in the response as `<IACA_ID>`. |
154 | | - |
155 | | -#### Activate the IACA |
156 | | - |
157 | | -To activate the IACA created in the previous step, run the following command: |
158 | | - |
159 | | -```bash |
160 | | -curl -i -X PUT '<MATTR_TENANT_URL>/v2/credentials/mobile/iacas/<IACA_ID>' \ |
161 | | --H 'Content-Type: application/json' \ |
162 | | --H 'Authorization: Bearer <BEARER_TOKEN>' \ |
163 | | --d '{ |
164 | | - "active": true |
165 | | -}' |
166 | | -``` |
167 | | - |
168 | | -Replace `<IACA_ID>` with the actual IACA ID from the previous step. |
169 | | - |
170 | | -The IACA certificate can now issue mobile credentials. |
171 | | - |
172 | | -### Step 2.5: Create mDoc credential configuration |
173 | | - |
174 | | -mDocs are ISO/IEC-compliant digital identity documents designed for secure storage, verification, and use on mobile wallets. The following command creates a mobile credential configuration that acts as a template for the mDoc credentials you want to issue. |
175 | | - |
176 | | -You can decide what data the credential contains, how it maps from your user attributes, and how it will appear in the mobile wallet. |
177 | | - |
178 | | -!!! note |
179 | | - |
180 | | - Learn more about mDoc credential configurations in the [MATTR documentation](https://learn.mattr.global/docs/issuance/credential-configuration/api-reference/mdocs){: target="_blank"}. |
181 | | - |
182 | | -```bash |
183 | | -curl -i -X POST '<MATTR_TENANT_URL>/v2/credentials/mobile/configurations' \ |
184 | | --H 'Content-Type: application/json' \ |
185 | | --H 'Authorization: Bearer <MATTR_BEARER_TOKEN>' \ |
186 | | --d '{ |
187 | | - "type": "<CREDENTIAL_TYPE>", |
188 | | - "expiresIn": { |
189 | | - "months": 1 |
190 | | - }, |
191 | | - "claimMappings": { |
192 | | - "<NAMESPACE>": { |
193 | | - "name": { |
194 | | - "mapFrom": "claims.name", |
195 | | - "type": "string" |
196 | | - }, |
197 | | - "email": { |
198 | | - "mapFrom": "claims.email", |
199 | | - "type": "string" |
200 | | - } |
201 | | - } |
202 | | - }, |
203 | | - "branding": { |
204 | | - "name": "<CREDENTIAL_NAME>", |
205 | | - "description": "<CREDENTIAL_DESCRIPTION>", |
206 | | - "backgroundColor": "#2d46d8" |
207 | | - }, |
208 | | - "includeStatus": true |
209 | | -}' |
210 | | -``` |
211 | | - |
212 | | -Update the values in the above request as follows: |
213 | | - |
214 | | -- `<CREDENTIAL_TYPE>`: Provide a unique identifier for your credential type. |
215 | | -- `<NAMESPACE>`: Define a namespace for your claims. |
216 | | -- `<CREDENTIAL_NAME>`: Provide a user-friendly name for the credential. |
217 | | -- `<CREDENTIAL_DESCRIPTION>`: Add a meaningful description for the credential. |
218 | | -- `claimMappings`: Configure how user claims from Asgardeo map to the mobile credential fields. |
219 | | - |
220 | | -!!! note |
221 | | - The section below refers to the `id` parameter of the response as `<MOBILE_CONFIG_ID>`. |
222 | | - |
223 | | -### Step 2.6: Generate credential offer URI |
224 | | - |
225 | | -The following command generates a credential offer URI that users’ mobile wallets can use to claim the credential defined in the mobile configuration. |
226 | | - |
227 | | -```bash |
228 | | -curl -i -X POST '<MATTR_TENANT_URL>/v1/openid/offers' \ |
229 | | --H 'Content-Type: application/json' \ |
230 | | --H 'Authorization: Bearer <MATTR_BEARER_TOKEN>' \ |
231 | | --d '{ |
232 | | - "credentials": ["<MOBILE_CONFIG_ID>"] |
233 | | -}' |
234 | | -``` |
235 | | - |
236 | | -The API response includes a `uri` field that digital wallets use to initiate the credential issuance flow. |
237 | | - |
238 | | -!!! tip "Share URI" |
239 | | - |
240 | | - You can either share the resulting `uri` directly, or convert this URI into a QR code for users to easily scan it. Some recommended QR code generators include, |
241 | | - |
242 | | - - [QR Code Generator](https://www.the-qrcode-generator.com/){: target="_blank"} |
243 | | - - [QR Server API](http://goqr.me/api/){: target="_blank"} |
244 | | - - [QR Code Creator](https://www.qr-code-generator.com/){:target="_blank"} |
245 | | - |
246 | | - Make sure to select the plain text option when generating the QR code. |
247 | | - |
248 | | -## Step 3: Update your application's callback URL in Asgardeo |
249 | | - |
250 | | -Now that you have set up MATTR, you need to update the callback URL of your application registered in Asgardeo to complete the integration. To do so, |
251 | | - |
252 | | -1. On the [Asgardeo Console](https://console.asgardeo.io/){: target="_blank"}, go to **Applications** and select your application. |
253 | | - |
254 | | -2. In the application's **Protocol** tab, update the **Authorized redirect URL** with the MATTR callback URL that takes the form: |
255 | | - |
256 | | - ```bash |
257 | | - <MATTR_TENANT_URL>/core/v1/oauth/authentication/callback |
258 | | - ``` |
259 | | - |
260 | | -3. Allow CORS for this URL by adding the MATTR origin to the **Allowed origins** field. |
261 | | - |
262 | | -4. Click **Update** to save the changes. |
263 | | - |
264 | | -## Step 4: Claim a credential in your mobile wallet and verify It |
265 | | - |
266 | | -Follow the steps given below to test the integration in action by issuing verifiable credentials to a MATTR Wallet. |
267 | | - |
268 | | -### Step 4.1: Download the MATTR GO Hold wallet |
269 | | - |
270 | | -Download the MATTR GO Hold mobile wallet application for your device. |
271 | | - |
272 | | -- **Android**: [Google Play Store](https://play.google.com/store/apps/details?id=global.mattr.wallet&hl=en){: target="_blank"} |
273 | | -- **iOS**: [Apple App Store](https://apps.apple.com/cr/app/mattr-go-hold/id1518660243){: target="_blank"} |
274 | | - |
275 | | -### Step 4.2: Claim your mobile credential |
276 | | - |
277 | | -To claim the created mobile credential, |
278 | | - |
279 | | -1. Open the MATTR GO Hold application on your mobile device. |
280 | | - |
281 | | -2. Select the **Scan** option from the main menu. |
282 | | - |
283 | | -3. Scan the QR code generated in step 2.6. |
284 | | - |
285 | | -4. Review the credential offer details and select **Accept**. |
286 | | - |
287 | | -5. Follow the authentication prompts to complete the credential claim process. |
288 | | - |
289 | | -### Step 4.3: Download the MATTR Go Verfiy app |
290 | | - |
291 | | -From a different device, download the MATTR GO Verify app. This app allows you to perform in-person verification of digital credentials stored in the MATTR GO Hold wallet. |
292 | | - |
293 | | -- **iOS devices**: [The App Store](https://apps.apple.com/us/app/mattr-go-verify/id6670461328){: target="_blank"} |
294 | | -- **Android devices**: [Google Play](https://play.google.com/store/apps/details?id=global.mattr.mobile.verifier){: target="_blank"} |
295 | | - |
296 | | -### Step 4.4 Verify credentials |
297 | | - |
298 | | -Follow the steps below to verify the mDocs credentials: |
299 | | - |
300 | | -1. From the device with the GO Hold app, |
301 | | - |
302 | | - 1. Open the app, select the **Share** button and then select **Share Credential**. |
303 | | - |
304 | | - 2. Select the **Connection QR** tab. This displays a QR code on the screen. |
305 | | - |
306 | | -2. From the device with the GO Verify app, |
307 | | - |
308 | | - 1. Select the **Scan** button. |
309 | | - |
310 | | - 2. Scan the QR code displayed in the GO Hold app in the other device. |
311 | | - |
312 | | - !!! note |
313 | | - You may need to allow the GO Verify app to access your camera. |
314 | | - |
315 | | - 3. Follow the on-screen instructions to complete the proximity verification workflow. |
316 | | - |
317 | | -You have now successfully issued verifiable credentials using Asgardeo as the OIDC attribute provider and verified them with MATTR. |
318 | | - |
319 | | -## Learn more |
320 | | - |
321 | | -Explore additional MATTR integration options and credential formats in the [MATTR Documentation](https://learn.mattr.global/){: target="_blank"}. |
| 1 | +{% include "../../includes/tutorials/connect-with-mattr.md" %} |
0 commit comments