Link copied to pasteboard!

Concepts

There are a few concepts that appear in multiple places across the SDK.

Client auth token

A client auth token is a JWT used to authorize a user to Cord in the browser. It needs to include your app ID, the ID for the user, and the ID for the organization the user is acting within. It must be signed by your application’s secret.

The token’s payload can include these fields:

Field Description
app_id required Your app ID.
user_id required, String or Number The ID for the user.
organization_id required, String or Number The ID for the user’s organization.
user_details optional If present, update’s the user’s details, or creates a user with those details if the user_id is new to Cord. This is an object that contains the same fields as the user management REST endpoint.
organization_details optional If present, update’s the organization’s details, or creates an organization with those details if the organization_id is new to Cord. This is an object that contains the same fields as the organization management REST endpoint.

If either the user_details or organization_details fields are included, the user will be added to that organization if they aren’t already a member. If neither is specified and the user isn’t a member, the token will produce an error if used.

Our server libraries can simplify the process of making client auth tokens.

Server auth token

A server auth token is a JWT used to authorize your server to make calls to our REST API. See the documentation for the REST API for details.

Context

The Cord SDK represents locations within your application as a flat JavaScript object we call a context. Contexts may only have string keys and values that are strings, numbers, or booleans.

Some APIs take a context that functions as a matcher. A matcher will filter a set of contexts (such as the locations of messages or users) to only those that match the defined properties of the matcher, ignoring other properties. For example, a matcher of { page: "hardware" } will match a context of { page: "hardware", paragraph: 3 } or { page: "hardware", item: "hammer" }, but not { page: "hardware/item/hammer" }

{
  "page": "hardware/item/hammer",
  "paragraph": 3
}