Request attributes

There are several type of attributes that can be stored on a user's Digital ID app. Yoti provides the ability to request these attributes by specifying a share policy.

The attributes are independent of each other, so they can be requested separately. In order to request the required attributes using our SDKs, see the following examples:

const {
DigitalIdentityBuilders: {
PolicyBuilder
}
} = require('yoti');

const policy = new PolicyBuilder()
// using predefined methods to request attributes
.withFullName()
.withEmail()
.withPhoneNumber()
.withPostalAddress()
.withSelfie()
.withAgeOver(18)
.withDateOfBirth()
.withNationality()
.withGender()
.withStructuredPostalAddress()
.withDocumentDetails()
.withDocumentImages()
.withWantedRememberMe()
// using attributes specified by name
.withWantedAttributeByName("given_names")
.withWantedAttributeByName("family_name")
// if you wish the user to prove it's them by taking a selfie on share
.withSelfieAuthentication()
Policy policy = Policy.builder()
// using predefined methods to request attributes
.withFullName()
.withEmail()
.withPhoneNumber()
.withPostalAddress()
.withSelfie()
.withAgeOver(18)
.withDateOfBirth()
.withNationality()
.withGender()
.withStructuredPostalAddress()
.withWantedRememberMe(true)
// using attributes specified by name
.withWantedAttribute(true,"given_names")
.withWantedAttribute(true,"family_name")
// if you wish the user to prove it's them by taking a selfie on share
.withSelfieAuthentication(true)
.build();
<?php

use Yoti\Identity\Policy\PolicyBuilder;

$policy = (new PolicyBuilder())
// using predefined methods to request attributes
->withFullName()
->withEmail()
->withPhoneNumber()
->withPostalAddress()
->withSelfie()
->withAgeOver(18)
->withDateOfBirth()
->withNationality()
->withGender()
->withStructuredPostalAddress()
->withDocumentDetails()
->withDocumentImages()
->withWantedRememberMe(true)
// using attributes specified by name
->withWantedAttributeByName("given_names")
->withWantedAttributeByName("family_name")
//if you wish the user to prove it's them by taking a selfie on share
->withSelfieAuthentication()
->build();
YotiPolicy policy = new PolicyBuilder()
// using predefined methods to request attributes
.withFullName()
.withEmail()
.WithPhoneNumber()
.WithPostalAddress()
.WithSelfie()
.WithAgeOver(18)
.WithDateOfBirth()
.WithNationality()
.WithGender()
.WithStructuredPostalAddress()
.WithDocumentDetails()
.WithDocumentImages()
.WithRememberMeId(true)
// using attributes specified by name
.WithWantedAttributeByName("given_names")
.WithWantedAttributeByName("family_name")
// if you wish the user to prove it's them by taking a selfie on share
.withSelfieAuthentication()
.Build();
policy := (&digitalidentity.PolicyBuilder{})
// using a predefined method to add an attribute
.WithFullName()
.WithEmail()
.WithPhoneNumber()
.WithPostalAddress()
.WithSelfie()
.WithAgeOver(18)
.WithDateOfBirth()
.WithNationality()
.WithGender()
.WithStructuredPostalAddress()
.WithDocumentDetails()
.WithDocumentImages()
.WithWantedRememberMe()
// using attributes specified by name
.withWantedAttributeByName("given_names")
.withWantedAttributeByName("family_name")
// if you wish the user to prove it's them by taking a selfie on share
.WithSelfieAuth()
.Build()

After creating the policy, you have to specify it in the session configuration as described here.

On This Page
Request attributes