Todoist login
Add Todoist as a sign-in option in an Auth.js application.
Auth.js · Const
Todoist is a built-in Auth.js OAuth provider. Configure it with Todoist client credentials and add the resulting provider configuration to Auth.js.
Todoist is a built-in Auth.js OAuth provider. Calling it with provider options creates an OAuth configuration that can be supplied in the Auth.js providers list; the default settings handle the standard Todoist OAuth flow, while explicit options can customize the provider.
function default<P>(options): OAuthConfig<P>| Name | Type | Description |
|---|---|---|
options | OAuthUserConfig<P> | OAuth provider options, parameterized by a profile type extending TodoistProfile. |
OAuthConfig<P>
import { Auth } from "@auth/core"
import Todoist from "@auth/core/providers/todoist"
const request = new Request(origin)
const response = await Auth(request, {
providers: [
Todoist({
clientId: TODOIST_CLIENT_ID,
clientSecret: TODOIST_CLIENT_SECRET,
}),
],
})Registers Todoist as an OAuth provider with its client credentials.
Add Todoist as a sign-in option in an Auth.js application.
Use the standard Todoist OAuth endpoints with minimal configuration.
Adapt the built-in provider to application-specific OAuth requirements.
Todoist is added by importing the provider and placing the result of Todoist(options) in the Auth.js providers array. The options shown by the reference are clientId and clientSecret.
Follow-up: What does the provider factory return? It returns an OAuthConfig parameterized by the provider profile type.
The callback endpoint is https://example.com/api/auth/callback/todoist. The Todoist application must use the corresponding callback URL for the deployed Auth.js base URL.
Follow-up: Why does the final path contain todoist? The provider identifier is part of the callback route used by Auth.js.
Todoist(options) accepts OAuthUserConfig<P>, where P extends TodoistProfile. It returns OAuthConfig<P>, which Auth.js consumes as a provider configuration.
Follow-up: How can defaults be changed? Supply supported provider options to the factory and customize the built-in OAuth configuration.
TodoistProfileOAuthUserConfigOAuthConfigAuthcustomizing a built-in OAuth provider