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
Property nameTypePIIDescription
sidSID<YK>
Not PII

A 34 character string that uniquely identifies this Access Token.

Pattern: ^YK[0-9a-fA-F]{32}$Min length: 34Max length: 34

account_sidSID<AC>

The unique SID identifier of the Account.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

service_sidSID<VA>

The unique SID identifier of the Verify Service.

Pattern: ^VA[0-9a-fA-F]{32}$Min length: 34Max length: 34

entity_identitystring

The unique external identifier for the Entity of the Service.


factor_typeenum<string>

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

Possible values:
push

factor_friendly_namestring
PII MTL: 30 days

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


tokenstring

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


urlstring<uri>

The URL of this resource.


ttlinteger

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

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
ServiceSidSID<VA>required

The unique SID identifier of the Service.

Pattern: ^VA[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
Identitystringrequired

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.


FactorTypeenum<string>required

The Type of this Factor. Eg. push

Possible values:
push

FactorFriendlyNamestringOptional

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


TtlintegerOptional

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

Create an AccessToken

create-an-accesstoken page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_21
// Download the helper library from https://www.twilio.com/docs/node/install
_21
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_21
_21
// Find your Account SID and Auth Token at twilio.com/console
_21
// and set the environment variables. See http://twil.io/secure
_21
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_21
const authToken = process.env.TWILIO_AUTH_TOKEN;
_21
const client = twilio(accountSid, authToken);
_21
_21
async function createAccessToken() {
_21
const accessToken = await client.verify.v2
_21
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_21
.accessTokens.create({
_21
factorType: "push",
_21
identity: "Identity",
_21
});
_21
_21
console.log(accessToken.sid);
_21
}
_21
_21
createAccessToken();

Output

_12
{
_12
"sid": "YKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens/YKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_12
}


Fetch an AccessToken resource

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

Property nameTypeRequiredPIIDescription
ServiceSidSID<VA>required

The unique SID identifier of the Service.

Pattern: ^VA[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<YK>required

A 34 character string that uniquely identifies this Access Token.

Pattern: ^YK[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function fetchAccessToken() {
_19
const accessToken = await client.verify.v2
_19
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.accessTokens("YKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.fetch();
_19
_19
console.log(accessToken.sid);
_19
}
_19
_19
fetchAccessToken();

Output

_12
{
_12
"sid": "YKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens/YKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_12
}


Rate this page: