Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Kinde · Module

getIdToken

getIdToken asynchronously returns Kinde’s raw ID token from memory. It accepts no arguments and may resolve to undefined when no ID token is available.

How it works

Call getIdToken without arguments to asynchronously retrieve the raw ID token held in memory. The promise resolves to the token string when one is available, or undefined otherwise.

Syntax

await kinde.getIdToken()

Returns

Promise<string | undefined>

Key points

  • Retrieves the unparsed ID token rather than a decoded claims object.
  • Because the method is asynchronous, await the result; it may resolve without a token.
  • The returned value is a JWT supplied after authentication.
  • The ID token can include the organizations associated with the user.
  • Kinde adds organization and permission information to token claims.

Common mistakes

  • Do not pass options; the documented options form is deprecated.
  • Use getIdToken for the ID token rather than relying on the deprecated getToken method.

Example: Read the raw ID token

import { kinde } from "@kinde/js-utils";

const idToken = await kinde.getIdToken();
console.log(idToken);

Awaits the raw ID token currently held in memory and logs it when available.

When to use it

Read identity-token data

Inspect the authenticated user’s raw identity token for client-side processing.

Read organization context

Access organization-related claims included in the ID token.

Modernize token access

Replace deprecated token retrieval usage in the new authentication flow.

Interview questions

QWhat does getIdToken return?

getIdToken is an asynchronous JavaScript SDK method that returns the raw ID token from memory. Its return type is Promise<string | undefined>, so callers should await it and account for the token being unavailable.

Follow-up: How would you distinguish it from an access-token helper? getIdToken returns the ID token, which carries identity-oriented claims; an access-token helper is used when authorizing API calls.

QDoes getIdToken accept options?

The method takes no arguments in the current API. The documentation marks the older getIdToken(options) form as deprecated.

Follow-up: What should a migration preserve? Remove the options argument and handle the promise result as possibly undefined.

QHow should callers handle the result?

The SDK keeps the raw ID token in memory and getIdToken retrieves it asynchronously. The result can be a string or undefined, so code should not assume authentication has produced a value.

Follow-up: What should code do when the result is undefined? Treat the user as lacking an available ID token and use the application’s authentication or reauthentication path.

  • getToken
  • id_token
  • org_code
  • permissions
  • kinde

Source: JavaScript SDK - Kinde docs. Checked 2026-10-15.