Factor Resource
The Factor
resource is currently used by Verify Push and Verify TOTP features. It represents a verification factor/channel. When the factor_type
is push
, it contains the public key for a single registered device and metadata. When the factor_type
is totp
, it contains the seed used to generate TOTP codes and metadata. Some Factor
properties apply to all factor_types
and others do not. A single Entity
links to multiple Factors
and a single Factor
links to multiple Challenges
.
Factor Properties
For security reasons the binding
property is ONLY returned upon creation, and is never returned afterwards.
Resource Properties in REST API format | |
---|---|
sid
|
A 34 character string that uniquely identifies this Factor. |
account_sid
|
The unique SID identifier of the Account. |
service_sid
|
The unique SID identifier of the Service. |
entity_sid
|
The unique SID identifier of the Entity. |
identity
|
Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. |
binding
|
Contains the The Binding property is ONLY returned upon Factor creation. |
date_created
|
The date that this Factor was created, given in ISO 8601 format. |
date_updated
|
The date that this Factor was updated, given in ISO 8601 format. |
friendly_name
|
The friendly name of this Factor. This can be any string up to 64 characters, meant for humans to distinguish between Factors.
For |
status
|
The Status of this Factor. One of |
factor_type
|
The Type of this Factor. Currently |
config
|
An object that contains configurations specific to a |
metadata
|
Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. |
url
|
The URL of this resource. |
Create a new Factor resource
POST
https://verify.twilio.com/v2/Services/{ServiceSid}/Entities/{Identity}/Factors
- Unverified Factors will be deleted and unverifiable after 1-24 hours from when they were created. This is done for security and clean-up reasons.
- In the request, if the specified
Entity
with the{Identity}
doesn't exist, it will be created automatically. You do not need to separately create a new Entity before making this request.
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The unique SID identifier of the Service. |
identity
Path
|
Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. |
friendly_name
Required
|
The friendly name of this Factor. This can be any string up to 64 characters, meant for humans to distinguish between Factors.
For |
factor_type
Required
|
The Type of this Factor. Currently |
binding.alg
Optional
|
The algorithm used when |
binding.public_key
Optional
|
The Ecdsa public key in PKIX, ASN.1 DER format encoded in Base64. Required when |
config.app_id
Optional
|
The ID that uniquely identifies your app in the Google or Apple store, such as Required when |
config.notification_platform
Optional
|
The transport technology used to generate the Notification Token. Can be Required when |
config.notification_token
Optional
|
For APN, the device token. For FCM, the registration token. It is used to send the push notifications. Must be between 32 and 255 characters long. Required when |
config.sdk_version
Optional
|
The Verify Push SDK version used to configure the factor Required when |
binding.secret
Optional
|
The shared secret for TOTP factors encoded in Base32. This can be provided when creating the Factor, otherwise it will be generated. Used when |
config.time_step
Optional
|
Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. The default value is defined at the service level in the property Used when |
config.skew
Optional
|
The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. The default value is defined at the service level in the property Used when |
config.code_length
Optional
|
Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. The default value is defined at the service level in the property Used when |
config.alg
Optional
|
The algorithm used to derive the TOTP codes. Can be Used when |
metadata
Optional
|
Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. |
Example 1
Example 2
Fetch a Factor resource
GET
https://verify.twilio.com/v2/Services/{ServiceSid}/Entities/{Identity}/Factors/{Sid}
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The unique SID identifier of the Service. |
identity
Path
|
Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. |
sid
Path
|
A 34 character string that uniquely identifies this Factor. |
Example 1
Read multiple Factor resources
GET
https://verify.twilio.com/v2/Services/{ServiceSid}/Entities/{Identity}/Factors
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The unique SID identifier of the Service. |
identity
Path
|
Customer unique identity for the Entity owner of the Factors. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. |
Example 1
Update a Factor resource
POST
https://verify.twilio.com/v2/Services/{ServiceSid}/Entities/{Identity}/Factors/{Sid}
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The unique SID identifier of the Service. |
identity
Path
|
Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. |
sid
Path
|
A 34 character string that uniquely identifies this Factor. |
auth_payload
Optional
|
The optional payload needed to verify the Factor for the first time. E.g. for a TOTP, the numeric code. |
friendly_name
Optional
|
The new friendly name of this Factor. It can be up to 64 characters. |
config.notification_token
Optional
|
For APN, the device token. For FCM, the registration token. It is used to send the push notifications. Required when |
config.sdk_version
Optional
|
The Verify Push SDK version used to configure the factor |
config.time_step
Optional
|
Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive |
config.skew
Optional
|
The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive |
config.code_length
Optional
|
Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive |
config.alg
Optional
|
The algorithm used to derive the TOTP codes. Can be |
config.notification_platform
Optional
|
The transport technology used to generate the Notification Token. Can be Required when |
Example 1
Delete a Factor resource
DELETE
https://verify.twilio.com/v2/Services/{ServiceSid}/Entities/{Identity}/Factors/{Sid}
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The unique SID identifier of the Service. |
identity
Path
|
Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. |
sid
Path
|
A 34 character string that uniquely identifies this Factor. |
Example 1
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.