auth.getCanvaUserToken

API reference for the auth.getCanvaUserToken method.

Gets a JSON Web Token (JWT) for the current user.

To learn more, see Verifying HTTP requests.

import { auth } from "@canva/user";
(async () => {
const token = await auth.getCanvaUserToken();
console.log(token);
})();
ts

A Promise that resolves with the following string:

#resultstring
Required

The JSON Web Token for the current user.

When decoded, the resulting object contains the following properties:

  • aud - The ID of the app.
  • brandId - The ID of the user's team.
  • userId - The ID of the user.