Major Changes
-
Change
SessionApi.getToken()
to return consistent{ data, errors }
return value (#2539) by @dimkland fix the
getToken()
from requestState to have the same return behavior as v4
(return Promise or throw error).
This change fixes issues withgetToken()
in@clerk/nextjs
/@clerk/remix
/@clerk/fastify
/@clerk/sdk-node
/gatsby-plugin-clerk
:Example:
import { getAuth } from '@clerk/nextjs/server'; const { getToken } = await getAuth(...); const jwtString = await getToken(...);
The change in
SessionApi.getToken()
return value is a breaking change, to keep the existing behavior use the following:import { ClerkAPIResponseError } from '@clerk/shared/error'; const response = await clerkClient.sessions.getToken(...); if (response.errors) { const { status, statusText, clerkTraceId } = response; const error = new ClerkAPIResponseError(statusText || '', { data: [], status: Number(status || ''), clerkTraceId, }); error.errors = response.errors; throw error; } // the value of the v4 `clerkClient.sessions.getToken(...)` const jwtString = response.data.jwt;
Minor Changes
-
Replace the
Clerk-Backend-SDK
header withUser-Agent
in BAPI requests and update it's value to contain both the package name and the package version of the clerk package (#2558) by @dimklexecuting the request. Eg request from
@clerk/nextjs
to BAPI with appendUser-Agent: @clerk/[email protected]
using the latest version.Miscellaneous changes: The backend test build changed to use tsup.
Patch Changes
- Updated dependencies [
8cc45d2af
]:- @clerk/[email protected]