Viki Platform

Show token

Returns information about the user associated with the token

GET /v5/sessions/TOKEN.json

Only a summary of the user is returned, use the user endpoint for full details.

Create Session

Viki credentials

Logs in a user. Must be over HTTPS

POST /v5/sessions.json

Expected body parameters:

Example:

{"username": "tyler","password": "relyt"}

The returned value includes two fields: token and user. The token acts like a session id, and should be included in any subsequent user-specific requests via token=TOKEN. The user field in general information about the user.

Facebook credentials

Logs a user using a valid Facebook access token. Must be over HTTPS. To get a Facebook access token please refer to Facebooks documentation.

POST /v5/sessions.json

Expected body parameters:

example

{"facebook_token": "1234567890"}

The returned value is the same as the Viki login. If the user has never logged in using Facebook two different things might happen:

1 - There is an existing viki account with the same email as the Facebook account. In this case the Facebook account is linked to the Viki account and the user is logged in.

2 - There is no user account with the Facebook account email. In this case a new user is created and logged in. The password for this new user is random and as such it can only log in using Facebook.

It is possible to pass Facebook credentials with a user already logged in via Viki credentials by passing the token=TOKEN query. In this case, the user that is logged in will be updated with the Facebook information as long as it is not linked to a different Facebook ID and the emails (in Viki and Facebook) match.

The data that its returned have the following format:

{"token": "A_TOKEN", "user": {"id": "1u", ...}}

Only a summary of the user is returned, use the user endpoint for full details.

Rakuten credentials

Logs a user using a valid Rakuten access token.

POST /v5/sessions.json

Expected body parameters:

example

{"rakuten_params": "..."}

The returned value is the same as the Viki login.

Google credentials

Logs a user using a valid Google access token. Must be over HTTPS. To get a Google access token please refer to Google's documentation.

POST /v5/sessions.json

Expected body parameters:

example

{"google_token": "1234567890"}

The returned value is the same as the Viki login. If the user doesn't exist or it exists a user with the same email, it will follow the same logic as the Facebook credentials section.

Apple credentials

Logs a user using a valid Apple access token (transaction receipt).

POST /v5/sessions.json

Expected body parameters:

example

{"apple_token": "a_nice_and_wordy_token"}

The returned value is the same as the Viki login.

Update tokens

Deletes the session and all other sessions of the user, rendering all tokens useless. Then it generates a new token for the user and returns it.

PUT /v5/sessions/TOKEN.json

The returned data has the same format as token creation.

Destroy Session

Deletes the session and all other sessions of the user, rendering all tokens useless.

DELETE /v5/sessions/TOKEN.json?token=TOKEN