Moodle
Configure Moodle’s built-in OAuth 2 login through Keycloak.
Use Moodle's built-in OAuth 2 authentication. Keycloak connects Moodle to the Ver.iD platform; Yivi is the example wallet.
What you need
First prepare your organization in Ver.iD Studio.
Moodle 4.5.15 LTS, Keycloak 26.8.1, HTTPS, working Moodle email delivery and a separate local administrator login. No Moodle login plugin is required.
Configure Ver.iD
Add Keycloak's callback URL in Ver.iD Studio → Verify → Authentications → your flow → Redirect URIs: <keycloak-base-url>/realms/<realm>/broker/verid/endpoint. See Add redirect URIs. Your application callback is configured separately on its Keycloak client.
Configure Keycloak
- Complete the Keycloak setup with
openid email phone, protected wallet attributes and theverid-wallet-claimsclient scope. Configure its verified-contact post-login flow. - On the four wallet-claim mappers, enable Add to userinfo. Keep upstream Ver.iD UserInfo disabled.
- Create a confidential OpenID Connect client with Standard flow = On. Disable Implicit flow, Direct access grants and Service accounts roles. Register
<moodle-base-url>/admin/oauth2callback.phpas the exact Valid redirect URIs entry. - Assign
basicandverid-wallet-claimsas default scopes; remove unused defaults. Moodle 4.5 does not send PKCE: leave this downstream client's PKCE requirement unset. Keep S256 on Keycloak's upstream Ver.iD connection.
Configure Moodle
Open Site administration → Server → OAuth 2 services → Custom:
| Setting | Value |
|---|---|
| Name | Wallet login |
| Client ID / Client secret | The Moodle client's Keycloak credentials |
| Authenticate token requests via HTTP headers | On |
| Service base URL | <keycloak-base-url>/realms/<realm> |
| This service will be used | Login page only |
| Name displayed on the login page | Log in with Digital Identity Wallet |
| Scopes included in a login request | openid |
| Offline scopes / additional parameters | Empty |
| Require email verification | On |
Save. Under Configure endpoints, check the realm's discovered authorization, token and UserInfo endpoints. Under Configure user field mappings, use sub → username, wallet_email → email and wallet_phone_number → phone1.
Enable OAuth 2 under Plugins → Authentication → Manage authentication. Leave Prevent account creation when authenticating disabled for new-account login; enable it for linking-only installations.
Test the login
In a private browser window, choose the wallet button and approve the request in Yivi. Confirm Moodle's email, choose the wallet login again, then complete the required local profile fields. Confirm the student account opens with no additional roles or enrolments. Sign out and repeat: the same account must return. Cancel a new request: no new session should appear.
Keep Require email verification enabled. Existing students should sign in locally and use Preferences → Linked logins; do not enable automatic email-based account linking.
Optional badge delivery
The separate course-badge issuer adds wallet delivery for an earned badge. It is independent of login and is the only Moodle download in these guides.