Skip to main content

Using Long-Lived API Tokens

Generating your Long Lived Token

Jesse Langford avatar
Written by Jesse Langford
Updated over 2 weeks ago

WARNING:

A Long-Lived Token provides full and permanent API access to your account. It should only be used for integrating legacy systems that not able to consume using our SDKs and are unable to dynamically generate a JWT for each request.

If you are integrating via REST then we strongly recommend you authenticate using a JWT, as per this guide.

Terminology

Long-Lived Token

A special token that grants full and permanent API access to an account.

JWT (Json Web Token)

The recommended standard method for authentication, especially when integrating via REST.

API Access

The ability to interact with the service's Application Programming Interface (API).

Legacy Systems

Older integration setups that may not have the capability to use modern authentication methods like SDKs or the dynamic generation of a JWT.

REST API

is a standard, stateless architectural style that uses HTTP methods (like GET and POST) to manage web resources identified by unique URLs.

PassKit Portal

The Web Portal where PassKit users can manually navigate to the Pass API settings and generate a Long-Lived Token.

Login Endpoint

The specific API URL used to programmatically obtain a token by sending a POST request with a special header.

Authorization Header

The required HTTP header used when consuming the REST API. The token must be included within this header.

Bearer Prefix

The required text that must precede the Long-Lived Token within the Authorization Header for successful authentication.


There are two ways you can obtain a long-lived API token:

Via the PassKit Portal

Navigate to Pass API's

Open the project you want to the Long Lived Token for, click on settings on the top menu, then click on the Pass API's in the side menu.


​Enter Your Password

Enter your account password, then click "Generate API Token"


​Copy Your Token

Upon successful authentication, your token will be displayed. You can now copy this and store somewhere safe.


Via the API

You can also obtain a token by calling the login endpoint with a special request header.

Example

METHOD: POST

HEADERS: x-passkit-longlived-token: true

BODY: { "username": "xxx", "password": "xxx" }

RESPONSE: { "token": "xxx" }

Long Lived Tokens are not Json Web Tokens. If you use a standard JWT library or a tool like jwt.io to inspect the token it will fail.

Usage

To use your token, include it in your authorisation header with a Bearer prefix to consume the REST API.

Authorization: Bearer token

Did this answer your question?