Skip to main content

Create JSON Web Tokens (JWTs)

API: Drive

This doc covers the Drive API. If you're using the Drive (classic) API, see the how-to guide for Drive (classic) JWTs.


Before getting started, ensure you have created and saved an access key from the Developer Portal.

To continue, you will need: developer_id, key_id and signing_secret

Install a JWT library

Most programming languages provide support for creating JSON Web Tokens (JWTs) either directly in the language or as a package. Select your language and then follow the instructions to install the package, if needed.

Open a terminal and navigate to your project directory, then run:

npm install jsonwebtoken

Generate a JWT

JWTs are created using an access key. Use these code snippets to generate a correctly-formatted JWT from your access key.

Copy the code snippet below into your project file. Replace PASTE_YOUR_ACCESS_KEY_HERE with your access key.

const jwt = require('jsonwebtoken')


const data = {
aud: 'doordash',
iss: accessKey.developer_id,
kid: accessKey.key_id,
exp: Math.floor( / 1000 + 60),
iat: Math.floor( / 1000),

const headers = { algorithm: 'HS256', header: { 'dd-ver': 'DD-JWT-V1' } }

const token = jwt.sign(
Buffer.from(accessKey.signing_secret, 'base64'),


Then, test your code. In your terminal, run:

node app.js

If you were successful, you should see output like this:

A screenshot of a terminal showing a successful run of the program