providers/logto
LogtoProfile
The returned user profile from Logto when using the profile callback. Reference.
Indexable
[claim
: string
]: unknown
Properties
address
address: string;
The user’s address
custom_data
custom_data: object;
Custom fields
email: string;
The user’s email
email_verified
email_verified: boolean;
A boolean indicating if the user’s email is verified
identities
identities: object;
The linked identities of the user
name
name: string;
The user’s name
organization_data
organization_data: object[];
The organization data the user belongs to
organization_roles
organization_roles: string[];
The organization roles the user belongs to with the format of <organization_id>
:<role_name>
organizations
organizations: string[];
The organization IDs the user belongs to
phone_number
phone_number: string;
The user’s phone number
phone_number_verified
phone_number_verified: boolean;
A boolean indicating if the user’s phone number is verified
picture
picture: string;
The user’s picture
sso_identities
sso_identities: object[];
The linked SSO identities of the user
sub
sub: string;
The user’s unique ID
username
username: string;
The user’s username
default()
default(options): OIDCConfig<LogtoProfile>
Setup
Callback URL
https://example.com/api/auth/callback/logto
Configuration
import { Auth } from "@auth/core"
import Logto from "@auth/core/providers/logto"
const request = new Request(origin)
const response = await Auth(request, {
providers: [
Logto({
clientId: LOGTO_ID,
clientSecret: LOGTO_SECRET,
issuer: LOGTO_ISSUER
}),
],
})
Configuring Logto
Follow these steps:
Go to the Logto Console
Applications -> Your application -> Settings -> Redirect URIs -> Add your callback url here <{{APP_URL}}/api/auth/callback/logto>
Then, create a .env.local
file in the project root add the following entries:
Get the following from the Logto’s Console:
AUTH_LOGTO_ID="<APP ID>" # Endpoints & Credentials -> App ID
AUTH_LOGTO_SECRET="<APP SECRET>" # Endpoints & Credentials -> App Secrets
AUTH_LOGTO_ISSUER="<LOGTO ENDPOINT>" # Endpoints & Credentials -> Logto endpoint
Resources
Notes
The Logto provider comes with a default configuration. To override the defaults for your use case, check out customizing a built-in OAuth provider.
By default, Auth.js assumes that the Logto provider is based on the OIDC spec
Help
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.
Parameters
Parameter | Type |
---|---|
options | OIDCUserConfig <LogtoProfile > |