Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Access Token Resource


Your client side application uses the AccessToken resource to authenticate its request to the Verify Push API when creating (i.e., enrolling or registering) an Entity and/or Factor.

(information)

Info

While this Verify Push AccessToken resource is similar to those used by Twilio voice/chat/video products, it cannot be reused between them.


AccessToken Properties

accesstoken-properties page anchor
Resource properties
sidtype: SID<YK>
Not PII

A 34 character string that uniquely identifies this Access Token.


account_sidtype: SID<AC>

The unique SID identifier of the Account.


service_sidtype: SID<VA>

The unique SID identifier of the Verify Service.


entity_identitytype: string

The unique external identifier for the Entity of the Service.


factor_typetype: enum<string>

The Type of the Factor. Currently only push is supported.

Possible values:
push

factor_friendly_nametype: string

A human readable description of this factor, up to 64 characters. For a push factor, this can be the device's name.


tokentype: string

The access token generated for enrollment, this is an encrypted json web token.


urltype: string<uri>

The URL of this resource.


ttltype: integer

How long, in seconds, the access token is valid. Max: 5 minutes



Create an AccessToken resource

create-an-accesstoken-resource page anchor
POST https://verify.twilio.com/v2/Services/{ServiceSid}/AccessTokens

Parameters

create-parameters page anchor
URI parameters
ServiceSidtype: SID<VA>
Path ParameterNot PII

The unique SID identifier of the Service.


Request body parameters
Identitytype: stringRequired

The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, and generated by your external system, such as your user's UUID, GUID, or SID.


FactorTypetype: enum<string>Required

The Type of this Factor. Eg. push

Possible values:
push

FactorFriendlyNametype: string

The friendly name of the factor that is going to be created with this access token


Ttltype: integer

How long, in seconds, the access token is valid. Can be an integer between 60 and 300. Default is 60.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.accessTokens
_11
.create({identity: 'identity', factorType: 'push'})
_11
.then(access_token => console.log(access_token.sid));

Output

_12
{
_12
"sid": "YKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"entity_identity": "ff483d1ff591898a9942916050d2ca3f",
_12
"factor_type": "push",
_12
"factor_friendly_name": "John Doe iPhone",
_12
"ttl": 300,
_12
"date_created": "2015-07-30T20:00:00Z",
_12
"token": "eyJ6aXAiOiJERUYiLCJraWQiOiJTQVNfUzNfX19LTVNfdjEiLCJjdHkiOiJ0d2lsaW8tZnBhO3Y9MSIsImVuYyI6IkEyNTZHQ00iLCJhbGciOiJkaXIifQ..qjltWfIgQaTwp2De.81Z_6W4kR-hdlAUvJQCbwS8CQ7QAoFRkOvNMoySEj8zEB4BAY3MXhPARfaK4Lnr4YceA2cXEmrzPKQ7bPm0XZMGYm1fqLYzAR8YAqUetI9WEdQLFytg1h4XnJnXhgd99eNXsLkpKHhsCnFkchV9eGpRrdrfB0STR5Xq0fdakomb98iuIFt1XtP0_iqxvxQZKe1O4035XhK_ELVwQBz_qdI77XRZBFM0REAzlnEOe61nOcQxkaIM9Qel9L7RPhcndcCPFAyYjxo6Ri5c4vOnszLDiHmeK9Ep9fRE5-Oz0px0ZEg_FgTUEPFPo2OHQj076H1plJnFr-qPINDJkUL_i7loqG1IlapOi1JSlflPH-Ebj4hhpBdMIcs-OX7jhqzmVqkIKWkpPyPEmfvY2-eA5Zpoo08YpqAJ3G1l_xEcHl28Ijkefj1mdb6E8POx41skAwXCpdfIbzWzV_VjFpmwhacS3JZNt9C4hVG4Yp-RGPEl1C7aJHRIUavAmoRHaXbfG20zzv5Zu0P5PcopDszzoqVfZpzc.GCt35DWTurtP-QaIL5aBSQ",
_12
"url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AccessTokens/YKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_12
}


Fetch an AccessToken resource

fetch-an-accesstoken-resource page anchor
GET https://verify.twilio.com/v2/Services/{ServiceSid}/AccessTokens/{Sid}

URI parameters
ServiceSidtype: SID<VA>
Path ParameterNot PII

The unique SID identifier of the Service.


Sidtype: SID<YK>
Path ParameterNot PII

A 34 character string that uniquely identifies this Access Token.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.accessTokens('YKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.fetch()
_11
.then(access_token => console.log(access_token.factorFriendlyName));

Output

_12
{
_12
"sid": "YKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"entity_identity": "ff483d1ff591898a9942916050d2ca3f",
_12
"factor_type": "push",
_12
"factor_friendly_name": "John Doe iPhone",
_12
"ttl": 60,
_12
"date_created": "2015-07-30T20:00:00Z",
_12
"token": "eyJ6aXAiOiJERUYiLCJraWQiOiJTQVNfUzNfX19LTVNfdjEiLCJjdHkiOiJ0d2lsaW8tZnBhO3Y9MSIsImVuYyI6IkEyNTZHQ00iLCJhbGciOiJkaXIifQ..qjltWfIgQaTwp2De.81Z_6W4kR-hdlAUvJQCbwS8CQ7QAoFRkOvNMoySEj8zEB4BAY3MXhPARfaK4Lnr4YceA2cXEmrzPKQ7bPm0XZMGYm1fqLYzAR8YAqUetI9WEdQLFytg1h4XnJnXhgd99eNXsLkpKHhsCnFkchV9eGpRrdrfB0STR5Xq0fdakomb98iuIFt1XtP0_iqxvxQZKe1O4035XhK_ELVwQBz_qdI77XRZBFM0REAzlnEOe61nOcQxkaIM9Qel9L7RPhcndcCPFAyYjxo6Ri5c4vOnszLDiHmeK9Ep9fRE5-Oz0px0ZEg_FgTUEPFPo2OHQj076H1plJnFr-qPINDJkUL_i7loqG1IlapOi1JSlflPH-Ebj4hhpBdMIcs-OX7jhqzmVqkIKWkpPyPEmfvY2-eA5Zpoo08YpqAJ3G1l_xEcHl28Ijkefj1mdb6E8POx41skAwXCpdfIbzWzV_VjFpmwhacS3JZNt9C4hVG4Yp-RGPEl1C7aJHRIUavAmoRHaXbfG20zzv5Zu0P5PcopDszzoqVfZpzc.GCt35DWTurtP-QaIL5aBSQ",
_12
"url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AccessTokens/YKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_12
}


Rate this page: