Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
API reference
trakt

providers/trakt

Built-in Trakt integration.

TraktUser

Extends

  • Record<string, any>

Properties

about

about: null | string;

age

age: null | number;

gender

gender: null | string;

ids

ids: {
  slug: string;
};
slug
slug: string;

images

images: {
  avatar: {
     full: string;
  };
};
avatar
avatar: {
  full: string;
};
avatar.full
full: string;

joined_at

joined_at: string;

location

location: null | string;

name

name: string;

private

private: boolean;

username

username: string;

vip

vip: boolean;

vip_ep

vip_ep: boolean;

default()

default<P>(options): OAuthConfig<P>

Add Trakt login to your page.

Setup

Callback URL

https://example.com/api/auth/callback/trakt

Configuration

import Auth from "@auth/core"
import Trakt from "@auth/core/providers/trakt"
 
const request = new Request(origin)
const response = await Auth(request, {
  providers: [Trakt({ clientId: TRAKT_CLIENT_ID, clientSecret: TRAKT_CLIENT_SECRET })],
})

Resources

If you’re using the api in production by calling api.trakt.tv. Follow the example. If you wish to develop on Trakt’s sandbox environment by calling api-staging.trakt.tv, change the URLs.

Start by creating an OAuth app on Trakt for production or development. Then set the Client ID and Client Secret as TRAKT_ID and TRAKT_SECRET in .env.

Notes

By default, Auth.js assumes that the Trakt provider is based on the OAuth 2 specification.

🚫
  • Trakt does not allow hotlinking images. Even the authenticated user’s profie picture.
  • Trakt does not supply the authenticated user’s email.
💡

The Trakt provider comes with a default configuration. To override the defaults for your use case, check out customizing a built-in OAuth provider.

Disclaimer If you think you found a bug in the default configuration, you can open an issue.

Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, we might not pursue a resolution. You can ask for more help in Discussions.

Type parameters

Type parameter
P extends TraktUser

Parameters

ParameterType
optionsOAuthUserConfig<P>

Returns

OAuthConfig<P>

Auth.js © Balázs Orbán and Team - 2024