API

Common

Getting Started

User

Register New User
Login
Logout
Refresh Access Token
Get User Profile
Update Profile
Upload Avatar
Delete User
Reset Password
Reset Password by ID

User Token

List User Tokens
Add User Token
Update Default User Token
Delete User Token
Verify User Token
Reset Verification Code

User vAtom

Get vAtom
Get vAtoms by Ids
Get vAtom Inventory
Search vAtoms
Geo Discover Groups
Geo Discover vAtoms
Update vAtoms
Perform Action
Trash vAtom

User Activity

Get My Threads
Get My Thread Messages

Template

List Templates
Get Template
Create Template
Update Template
Delete Template

Template Variation

List Variations
Get Variation
Create Variation
Update Variation
Delete Variation

vAtom

Emit vAtom

Template Action

List Actions
Get Action
Register Action Handler
Register Action
Update Action
Delete Action

Template Face

List Faces
Register Face
Update Face
Delete Face

Asset

Upload Assets
Get Assets
Delete Assets

Add User Token

POST
https://api.blockv.io/v1/user/tokens

Overview

Adds a new user token for the currently logged in user.

A user token is an identifier that can be used to authenticate a user.

The authentication method depends on the user token. Some tokens support authentication via password, while other user tokens support authentication via a third party provider.

Some of the token_types are also addressable and can be used to send notifications to a user.

The combination of token and token_type is unique because it is used to identify a user.

There can be exactly one user token that is flagged as the default token. If not specified by the user, then this is the first token that was associated with the user object. The default token is used to send notifications if no specific token is selected.

Add User Token Request

HTTP Headers

Content-Type: application/json App-Id: {app_id}

Payload Details

NameTypeDescription
tokenstringThe value of the token, for example john.doe@example.com
token_type * stringThe type of the token, for example email.
is_primarybooleanFlag to indicate if this token is the primary token.
auth_dataobjectContains the data that is used for authentiation.

Supported token types

  • email
  • phone_number
  • facebook

Sample Request: Add an email address

{
	"token" : "new.email@example.com",
	"token_type" : "email"
}

Sample Request: Add an phone number

{
	"token" : "+11234567899",
	"token_type" : "phone_number"
}

Sample Request: Add facebook

{
    "token": "1234567",
    "token_type": "facebook",
    "is_primary": false,
    "auth_data": {
      "code": "CAAKufIJSLC0BAEyrQkyFsCb2ziiwa...."
    }
}

Add User Token Response

After a successful creation, the full user token object is returned.

Return & Error Codes

ErrorTypeDescription
200httpEverything is OK
400httpBad Request
403httpNot Authorized
409httpThe token is already in use

payload object

NameTypeDescription
idstringThe token's unique identifier, a 36 character UUID.
metaobjectThe object's meta information (for example the creation timestamp).
propertiesobjectThe properties of the object.

properties Object

NameTypeDescription
user_idstringUnique identifier of the user object that is referenced by the token.
app_idstringUnique identifier of the application object that created the user.
token_typestringThe type of the token, for example email .
tokenstringThe value of the token, for example john.doe@example.com .
confirmedbooleanFlag to indicate if the token is confirmed, for example after the user clicked a verification link in an email.
is_primarybooleanFlag to indicate if this token is the primary token. The primary token is used when no other token is explicitly selected, for example to send messages. This will automatically set the is_primary flag of an existing token to false , because only one token can be the primary token.

Sample Response

{
    "payload": {
            "id": "29828993-c2b4-4f6b-a289-f4bdd965d069",
            "meta": {
                "data_type": "blockv::token",
                "when_created": "2018-01-01T00:00:00+00:00",
                "when_modified": "2018-01-01T00:00:00+00:00"
            },
            "properties": {
                "user_id": "001d0933-88e6-4e17-b147-0f672dc016d1",
                "app_id": "ebd04065-41d3-4e30-9844-44c594f6b17f",
                "token_type": "email",
                "token": "new.email@example.com",
                "confirmed": false,
                "is_primary": false
            }
        }
}
©2020 BLOCKv
Info