Skip to main content

getAuthToken()

function getAuthToken(args: AuthTokenRequestArgs, baseUrl?: string): Promise<AuthTokenResponse>

Exchanges an authorization code for an access token.

Parameters

ParameterType
argsAuthTokenRequestArgs
baseUrl?string

Returns

Promise<AuthTokenResponse>

The access token response

Example

const { accessToken } = await getAuthToken({
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
code: authCode
})

Throws

TodoistRequestError If the token exchange fails