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

Auth.js · Type Alias

Account

Account is the Auth.js core type for information about the provider used during authentication. It also includes TokenSet fields for provider-returned token data.

How it works

Account describes the provider-specific connection used for authentication. It includes provider identity, provider type, and token-related values inherited from TokenSet, with some fields varying by provider.

Syntax

type Account = Partial<TokenEndpointResponse> & {
  provider: string
  type: ProviderType
  providerAccountId: string
  ...
}

Returns

An Account object describing the authentication provider connection and its provider-specific token or identity data.

Key points

  • Account models the provider connection involved in authentication.
  • Its shape includes token-set data returned by OAuth providers.
  • The provider field stores the configured provider identifier.
  • The type field records the provider category through ProviderType.
  • Account identity values are interpreted according to the provider category.

Example: Read an account's provider identifier

import type { Account } from "@auth/core/types"

export function providerId(account: Account): string {
  return account.provider
}

Accepts an Auth.js account and returns the identifier of the provider associated with it.

When to use it

Inspect the provider involved in a sign-in callback

Callback handling

Carry OAuth token-set values associated with an account

Token persistence

Branch behavior using provider and type

Provider-specific logic

Interview questions

QWhat does the Account type represent?

Account represents information about the provider used for a sign-in. It also extends TokenSet, so it can carry tokens returned by an OAuth provider.

Follow-up: How would you distinguish an OAuth account from an email account? Use the account's provider and type fields; the type identifies the provider category.

QWhich fields identify an account's provider?

The provider field identifies the configured provider, such as Google. The type field uses ProviderType and identifies the provider category.

Follow-up: What additional value can the provider field have for credentials authentication? It identifies the configured credentials provider, while the account identifier is provider-specific.

QWhy does Account vary by provider?

Account can contain token information because it extends TokenSet. The exact account identifier and related values depend on the provider type.

Follow-up: Why should persistence code account for provider differences? OAuth, email, and credentials providers supply different identity and token data.

  • TokenSet
  • ProviderType
  • AdapterAccount
  • User
  • Profile

Source: Types. Checked 2026-10-15.