/tokens

Description

Access tokens are used to authenticate users using Embed Option 1 from the Next Tech content editor.

Access tokens automatically expire after 24 hours.

post
Create Token

https://api.next.tech/v1/tokens
Generate a new access token for a given user and content. If the user has loaded this content before, the access token returned will link to their current project. Otherwise, a new project will be created.Any amount of metadata key/value pairs may be provided. If provided, the current project metadata will be overwritten with the provided metadata.
Request
Response
Request
Body Parameters
content_id
required
string
Content identifier (from creator) Example: bef80481-0424-491f-a885-52d78a875f14
user_id
required
string
Unique (and static) user identifier (used to enable persistent coding environments) Example: u333
first_name
optional
string
User's first name (to enable use via templates) Example Codey
last_name
optional
string
User's last name (to enable use via templates) Example: Codester
email
optional
string
User's email (to enable use via templates) Example: codey@next.tech
reset
optional
boolean
If a new project should be returned instead of an existing one (if it exists).
metadata[][value]
optional
string
The value for the new project metadata.
metadata[][key]
optional
string
The key for the new project metadata.
Response
200: OK
{
"access_token": "39242392AC5FA5173E3D87D57F71C9B7",
"metadata": [
{
"key": "user_id",
"value": "10"
},
{
"key": "course_id",
"value": "101"
}
],
"expires_at": "2018-07-23T23:18:33.485Z",
"project_id": 1,
"project_url": "https://next.tech/projects/30e44804-4f80-45f4-a98d-041d3034e435?access_token=39242392AC5FA5173E3D87D57F71C9B7",
"project_uid": "30e44804-4f80-45f4-a98d-041d3034e435"
}

put

https://api.next.tech/v1/projects/:uid/metadata
Request
Response
Request
Body Parameters
metadata[][key]
required
string
The key for the new metadata.
Response
200: OK

put

https://api.next.tech/v1/projects/:uid/metadata
Request
Response
Request
Body Parameters
metadata[][key]
required
string
The key for the new metadata.
Response
200: OK

put

https://api.next.tech/v1/projects/:uid/metadata
Request
Response
Request
Body Parameters
metadata[][key]
required
string
The key for the new metadata.
Response
200: OK

put

https://api.next.tech/v1/projects/:uid/metadata
Request
Response
Request
Body Parameters
metadata[][key]
required
string
The key for the new metadata.
Response
200: OK

put

https://api.next.tech/v1/projects/:uid/metadata
Request
Response
Request
Body Parameters
metadata[][key]
required
string
The key for the new metadata.
Response
200: OK

post
Refresh Token

https://api.next.tech/v1/tokens/:token/refresh
Refresh an existing access token.
Request
Response
Request
Path Parameters
token
required
string
Access token string
Response
200: OK
{
"access_token": "C40C42B507B68EC8CEFF2E7B1170BB48",
"expires_at": "2018-07-23T23:16:40.485Z",
"project_id": 2,
"project_uid": "119e3fc6-5f19-4690-a345-aefdd1f34180"
}