user-attributes
User Attributes
Prerequisites
This skill assumes a working Internet Identity sign-in built with @icp-sdk/auth: load the user-sign-in skill first. The attribute bundle travels alongside a delegation, so there is nothing here to request without one.
The frontend_origins value configured below must be the origin identities are derived for, the primary origin where the app has pinned one, not the origin the user happens to be visiting. A suite gets this wrong by default.
- For a Motoko backend:
mo:identity-attributes>= 0.4.0 (mops). It pulls inmo:core>= 2.5.0 and requiresmoc>= 1.6.0 forinclude. - For a Rust backend: the
identity-attributescrate andic-cdk>= 0.20.1.
How it works
When the backend needs more than the principal, II returns a signed attribute bundle alongside the delegation. The backend exposes two methods: _internet_identity_sign_in_start issues a nonce, _internet_identity_sign_in_finish verifies the bundle. The identity-attributes library adds both, in Motoko and in Rust, with the same checks, the same environment variables and the same Candid types, so one frontend works against either backend.
Keys
requestAttributes({ keys, nonce }) requires both; there is no default key set.