@clerk/upgrade 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/guide-generators/text-generation.js +109 -0
- package/dist/guide-generators/v5/backend/__output.mdx +580 -0
- package/dist/guide-generators/v5/backend/import-moves.mdx +3 -0
- package/dist/guide-generators/v5/backend/import-paths.mdx +3 -0
- package/dist/guide-generators/v5/backend/index.js +22 -0
- package/dist/guide-generators/v5/backend/intro.mdx +3 -0
- package/dist/guide-generators/v5/chrome-extension/index.js +19 -0
- package/dist/guide-generators/v5/chrome-extension/intro.mdx +3 -0
- package/dist/guide-generators/v5/chromeExtension/__output.mdx +409 -0
- package/dist/guide-generators/v5/chromeExtension/index.js +24 -0
- package/dist/guide-generators/v5/chromeExtension/intro.mdx +3 -0
- package/dist/guide-generators/v5/expo/__output.mdx +455 -0
- package/dist/guide-generators/v5/expo/index.js +24 -0
- package/dist/guide-generators/v5/expo/intro.mdx +3 -0
- package/dist/guide-generators/v5/fastify/__output.mdx +373 -0
- package/dist/guide-generators/v5/fastify/index.js +22 -0
- package/dist/guide-generators/v5/fastify/intro.mdx +3 -0
- package/dist/guide-generators/v5/gatsby/__output.mdx +472 -0
- package/dist/guide-generators/v5/gatsby/index.js +24 -0
- package/dist/guide-generators/v5/gatsby/intro.mdx +3 -0
- package/dist/guide-generators/v5/generate-all.js +0 -0
- package/dist/guide-generators/v5/generate-all.sh +16 -0
- package/dist/guide-generators/v5/generate.js +263 -0
- package/dist/guide-generators/v5/intro.mdx +15 -0
- package/dist/guide-generators/v5/js/__output.mdx +528 -0
- package/dist/guide-generators/v5/js/index.js +27 -0
- package/dist/guide-generators/v5/js/intro.mdx +3 -0
- package/dist/guide-generators/v5/js/pagination-args.mdx +3 -0
- package/dist/guide-generators/v5/js/pagination-return.mdx +3 -0
- package/dist/guide-generators/v5/nextjs/__output.mdx +1091 -0
- package/dist/guide-generators/v5/nextjs/after-sign-x-handling.mdx +10 -0
- package/dist/guide-generators/v5/nextjs/deprecation-removals.mdx +9 -0
- package/dist/guide-generators/v5/nextjs/import-changes.mdx +98 -0
- package/dist/guide-generators/v5/nextjs/index.js +24 -0
- package/dist/guide-generators/v5/nextjs/intro.mdx +3 -0
- package/dist/guide-generators/v5/nextjs/middleware-changes.mdx +251 -0
- package/dist/guide-generators/v5/nextjs/nextjs-versio.mdx +34 -0
- package/dist/guide-generators/v5/nextjs/nextjs-version.mdx +6 -0
- package/dist/guide-generators/v5/nextjs/retheme-changes.mdx +10 -0
- package/dist/guide-generators/v5/nextjs/version-requirements.mdx +34 -0
- package/dist/guide-generators/v5/node/__output.mdx +511 -0
- package/dist/guide-generators/v5/node/index.js +22 -0
- package/dist/guide-generators/v5/node/intro.mdx +3 -0
- package/dist/guide-generators/v5/node/node-setters-removals.mdx +34 -0
- package/dist/guide-generators/v5/overview/__output.mdx +37 -0
- package/dist/guide-generators/v5/overview/index.js +12 -0
- package/dist/guide-generators/v5/overview/intro.mdx +31 -0
- package/dist/guide-generators/v5/overview/per-sdk.mdx +16 -0
- package/dist/guide-generators/v5/per-sdk.mdx +16 -0
- package/dist/guide-generators/v5/prepare.mdx +135 -0
- package/dist/guide-generators/v5/react/__output.mdx +679 -0
- package/dist/guide-generators/v5/react/hof-removals.mdx +3 -0
- package/dist/guide-generators/v5/react/index.js +24 -0
- package/dist/guide-generators/v5/react/intro.mdx +3 -0
- package/dist/guide-generators/v5/redesigned-components.mdx +11 -0
- package/dist/guide-generators/v5/remix/__output.mdx +401 -0
- package/dist/guide-generators/v5/remix/index.js +24 -0
- package/dist/guide-generators/v5/remix/intro.mdx +3 -0
- package/dist/guide-generators/v5/retheme/__output.mdx +437 -0
- package/dist/guide-generators/v5/retheme/index.js +24 -0
- package/dist/guide-generators/v5/retheme/intro.mdx +9 -0
- package/dist/guide-generators/v5/shared/after-sign-x-handling.mdx +10 -0
- package/dist/guide-generators/v5/shared/cli.mdx +22 -0
- package/dist/guide-generators/v5/shared/deprecation-removals.mdx +6 -0
- package/dist/guide-generators/v5/shared/hof-removals.mdx +3 -0
- package/dist/guide-generators/v5/shared/image-url.mdx +3 -0
- package/dist/guide-generators/v5/shared/node-setters-removals.mdx +34 -0
- package/dist/guide-generators/v5/shared/node-version.mdx +3 -0
- package/dist/guide-generators/v5/shared/orgs-claim.mdx +50 -0
- package/dist/guide-generators/v5/shared/pagination-args.mdx +3 -0
- package/dist/guide-generators/v5/shared/pagination-return.mdx +3 -0
- package/dist/guide-generators/v5/shared/path-routing.mdx +57 -0
- package/dist/guide-generators/v5/shared/prepare.mdx +10 -0
- package/dist/guide-generators/v5/shared/react-version.mdx +20 -0
- package/dist/guide-generators/v5/shared/redesign-preview.mdx +5 -0
- package/dist/guide-generators/v5/shared/update-v5.mdx +17 -0
- package/dist/guide-generators/v5/shared/update-version.mdx +18 -0
- package/dist/guide-generators/v5/single-page-old.js +192 -0
- package/dist/guide-generators/v5-guides/deprecation-removals.mdx +7 -0
- package/dist/guide-generators/v5-guides/generate.js +263 -0
- package/dist/guide-generators/v5-guides/hof-removals.mdx +3 -0
- package/dist/guide-generators/v5-guides/intro.mdx +15 -0
- package/dist/guide-generators/v5-guides/nextjs/after-sign-x-handling.mdx +10 -0
- package/dist/guide-generators/v5-guides/nextjs/deprecation-removals.mdx +9 -0
- package/dist/guide-generators/v5-guides/nextjs/import-changes.mdx +98 -0
- package/dist/guide-generators/v5-guides/nextjs/index.js +80 -0
- package/dist/guide-generators/v5-guides/nextjs/intro.mdx +21 -0
- package/dist/guide-generators/v5-guides/nextjs/middleware-changes.mdx +251 -0
- package/dist/guide-generators/v5-guides/nextjs/retheme-changes.mdx +10 -0
- package/dist/guide-generators/v5-guides/nextjs/version-requirements.mdx +34 -0
- package/dist/guide-generators/v5-guides/node-setters-removals.mdx +34 -0
- package/dist/guide-generators/v5-guides/pagination-args.mdx +3 -0
- package/dist/guide-generators/v5-guides/pagination-return.mdx +3 -0
- package/dist/guide-generators/v5-guides/path-routing.mdx +50 -0
- package/dist/guide-generators/v5-guides/per-sdk.mdx +16 -0
- package/dist/guide-generators/v5-guides/prepare.mdx +135 -0
- package/dist/guide-generators/v5-guides/redesign-preview.mdx +5 -0
- package/dist/guide-generators/v5-guides/redesigned-components.mdx +11 -0
- package/dist/guide-generators/v5-guides/remix/index.js +15 -0
- package/dist/guide-generators/v5-guides/remix/intro.mdx +1 -0
- package/dist/guide-generators/v5-guides/remix/output.mdx +362 -0
- package/dist/guide-generators/v5-guides/shared/breaking-changes-intro.mdx +0 -0
- package/dist/guide-generators/v5-guides/shared/cli.mdx +21 -0
- package/dist/guide-generators/v5-guides/shared/deprecation-removals.mdx +7 -0
- package/dist/guide-generators/v5-guides/shared/hof-removals.mdx +3 -0
- package/dist/guide-generators/v5-guides/shared/node-setters-removals.mdx +34 -0
- package/dist/guide-generators/v5-guides/shared/node-version.mdx +3 -0
- package/dist/guide-generators/v5-guides/shared/pagination-args.mdx +3 -0
- package/dist/guide-generators/v5-guides/shared/pagination-return.mdx +3 -0
- package/dist/guide-generators/v5-guides/shared/path-routing.mdx +50 -0
- package/dist/guide-generators/v5-guides/shared/prepare.mdx +7 -0
- package/dist/guide-generators/v5-guides/shared/react-version.mdx +19 -0
- package/dist/guide-generators/v5-guides/shared/redesign-preview.mdx +5 -0
- package/dist/guide-generators/v5-guides/shared/update-v5.mdx +17 -0
- package/dist/guide-generators/v5-guides/shared/upgrade-v5.mdx +17 -0
- package/dist/scan.js +4 -2
- package/dist/util/generate-nextjs-migration-guide.js +0 -0
- package/dist/util/generate-nextjs-v5-migration-guide.js +0 -0
- package/dist/util/load-change.js +1 -0
- package/dist/util/text-generation.js +29 -0
- package/dist/util/v5-guide/deprecation-removals.mdx +7 -0
- package/dist/util/v5-guide/generate.js +200 -0
- package/dist/util/v5-guide/getting-up-to-date.mdx +114 -0
- package/dist/util/v5-guide/hof-removals.mdx +3 -0
- package/dist/util/v5-guide/intro.mdx +15 -0
- package/dist/util/v5-guide/node-setters-removals.mdx +34 -0
- package/dist/util/v5-guide/pagination-args.mdx +3 -0
- package/dist/util/v5-guide/pagination-return.mdx +3 -0
- package/dist/util/v5-guide/path-routing.mdx +50 -0
- package/dist/util/v5-guide/per-sdk.mdx +16 -0
- package/dist/util/v5-guide/prepare.mdx +135 -0
- package/dist/util/v5-guide/redesign-preview.mdx +5 -0
- package/dist/util/v5-guide/redesigned-components.mdx +11 -0
- package/dist/util/v5-guide/remix.mdx +0 -0
- package/dist/util/v5-guides/deprecation-removals.mdx +7 -0
- package/dist/util/v5-guides/generate.js +200 -0
- package/dist/util/v5-guides/hof-removals.mdx +3 -0
- package/dist/util/v5-guides/intro.mdx +15 -0
- package/dist/util/v5-guides/nextjs/after-sign-x-handling.mdx +10 -0
- package/dist/util/v5-guides/nextjs/deprecation-removals.mdx +9 -0
- package/dist/util/v5-guides/nextjs/generate.js +80 -0
- package/dist/util/v5-guides/nextjs/import-changes.mdx +98 -0
- package/dist/util/v5-guides/nextjs/index.js +0 -0
- package/dist/util/v5-guides/nextjs/intro.mdx +21 -0
- package/dist/util/v5-guides/nextjs/middleware-changes.mdx +251 -0
- package/dist/util/v5-guides/nextjs/retheme-changes.mdx +10 -0
- package/dist/util/v5-guides/nextjs/version-requirements.mdx +34 -0
- package/dist/util/v5-guides/node-setters-removals.mdx +34 -0
- package/dist/util/v5-guides/pagination-args.mdx +3 -0
- package/dist/util/v5-guides/pagination-return.mdx +3 -0
- package/dist/util/v5-guides/path-routing.mdx +50 -0
- package/dist/util/v5-guides/per-sdk.mdx +16 -0
- package/dist/util/v5-guides/prepare.mdx +135 -0
- package/dist/util/v5-guides/redesign-preview.mdx +5 -0
- package/dist/util/v5-guides/redesigned-components.mdx +11 -0
- package/dist/util/v5-guides/remix/index.js +5 -0
- package/dist/util/v5-nextjs-guide/after-sign-x-handling.mdx +10 -0
- package/dist/util/v5-nextjs-guide/deprecation-removals.mdx +9 -0
- package/dist/util/v5-nextjs-guide/generate-nextjs-v5-migration-guide.js +0 -0
- package/dist/util/v5-nextjs-guide/generate.js +80 -0
- package/dist/util/v5-nextjs-guide/import-changes.mdx +98 -0
- package/dist/util/v5-nextjs-guide/intro.md +0 -0
- package/dist/util/v5-nextjs-guide/intro.mdx +21 -0
- package/dist/util/v5-nextjs-guide/middleware-changes.mdx +251 -0
- package/dist/util/v5-nextjs-guide/retheme-changes.mdx +11 -0
- package/dist/util/v5-nextjs-guide/version-requirements.mdx +34 -0
- package/dist/versions/v5/backend/appearance-organizationpreview-organizationswitcher.md +9 -0
- package/dist/versions/v5/backend/authenticaterequest-params-change.md +1 -0
- package/dist/versions/v5/backend/clockskewinseconds.md +1 -0
- package/dist/versions/v5/backend/constants-import-path-move.md +1 -0
- package/dist/versions/v5/backend/createauthenticaterequest-import-path-move.md +1 -0
- package/dist/versions/v5/backend/createclerkclient-apikey.md +1 -0
- package/dist/versions/v5/backend/createclerkclient-frontendapi.md +1 -0
- package/dist/versions/v5/backend/createisomorphicrequest-import-path-move.md +1 -0
- package/dist/versions/v5/backend/createisomorphicrequest-removed.md +1 -0
- package/dist/versions/v5/backend/decodejwt-import-path-move.md +1 -0
- package/dist/versions/v5/backend/externalaccount-picture.md +1 -0
- package/dist/versions/v5/backend/externalaccountjson-avatarurl.md +1 -0
- package/dist/versions/v5/backend/getorganizationinvitationlist-return-signature.md +1 -0
- package/dist/versions/v5/backend/getorganizationinvitationlist-return-type-change.md +17 -0
- package/dist/versions/v5/backend/getorganizationlist-return-signature.md +1 -0
- package/dist/versions/v5/backend/getorganizationmembershiplist-return-signature.md +1 -0
- package/dist/versions/v5/backend/httpoptions-removed.md +2 -1
- package/dist/versions/v5/backend/organizationjson-logourl.md +1 -0
- package/dist/versions/v5/backend/organizationmembershippublicuserdatajson-profileimageurl.md +1 -0
- package/dist/versions/v5/backend/redirect-import-path-move.md +1 -0
- package/dist/versions/v5/backend/signjwt-import-path-move.md +1 -0
- package/dist/versions/v5/backend/signjwterror-import-move.md +1 -0
- package/dist/versions/v5/backend/tokenverificationerror-import-move.md +1 -0
- package/dist/versions/v5/backend/tokenverificationerroraction-import-move.md +1 -0
- package/dist/versions/v5/backend/tokenverificationerrorcode-import-move.md +1 -0
- package/dist/versions/v5/backend/tokenverificationerrorreason-import-move.md +1 -0
- package/dist/versions/v5/backend/userjson-profileimageurl.md +1 -0
- package/dist/versions/v5/backend/verifyjwt-import-path-move.md +1 -0
- package/dist/versions/v5/chromeExtension/clerkprovider-tokencache.md +8 -10
- package/dist/versions/v5/common/aftersigninurl-behavior-change-2.md +1 -0
- package/dist/versions/v5/common/aftersignouturl-behavior-change.md +1 -0
- package/dist/versions/v5/common/aftersignupurl-behavior-change.md +1 -0
- package/dist/versions/v5/common/afterswitchorganizationurl.md +1 -0
- package/dist/versions/v5/common/alternativemethods-backlink.md +1 -0
- package/dist/versions/v5/common/api-key-to-secret-key.md +1 -0
- package/dist/versions/v5/common/appearance-organizationpreview-organizationswitcher.md +1 -0
- package/dist/versions/v5/common/button-to-organizationlistcreateorganizationactionbutton.md +1 -0
- package/dist/versions/v5/common/card-changes.md +3 -2
- package/dist/versions/v5/common/changed-localization-keys.md +121 -120
- package/dist/versions/v5/common/clerkprovider-frontendapi-2.md +1 -0
- package/dist/versions/v5/common/clerkprovideroptionswrapper-dropped.md +1 -0
- package/dist/versions/v5/common/connected-accounts-dropdown.md +1 -0
- package/dist/versions/v5/common/emaillinkerrorcode-import-change.md +1 -0
- package/dist/versions/v5/common/externalaccount-avatarurl.md +7 -0
- package/dist/versions/v5/common/externalaccount-picture.md +7 -0
- package/dist/versions/v5/common/externalaccountjson-avatarurl.md +7 -0
- package/dist/versions/v5/common/frontend-api-to-publishable-key.md +1 -0
- package/dist/versions/v5/common/getorganizationinvitationlist-return-signature.md +15 -0
- package/dist/versions/v5/common/getorganizationinvitationlist-return-type-change.md +8 -5
- package/dist/versions/v5/common/getorganizationlist-return-signature.md +15 -0
- package/dist/versions/v5/common/getorganizationlist-return-type-change.md +2 -1
- package/dist/versions/v5/common/getorganizationmembershiplist-return-type-change.md +2 -1
- package/dist/versions/v5/common/isclerkapiresponserror-import-change.md +1 -0
- package/dist/versions/v5/common/isemaillinkerror-import-change.md +1 -0
- package/dist/versions/v5/common/isknownerror-import-change.md +1 -0
- package/dist/versions/v5/common/ismetamaskerror-import-change.md +6 -5
- package/dist/versions/v5/common/mfa-dropdown.md +1 -0
- package/dist/versions/v5/common/min-react-version.md +2 -0
- package/dist/versions/v5/common/multisessionappsupport-import-change.md +1 -1
- package/dist/versions/v5/common/navigate-to-routerpush-routerreplace.md +1 -0
- package/dist/versions/v5/common/new-localization-keys.md +121 -120
- package/dist/versions/v5/common/organization-create-string.md +12 -0
- package/dist/versions/v5/common/organization-getdomains-arguments-change.md +1 -0
- package/dist/versions/v5/common/organization-getinvitations-arguments-changed.md +1 -0
- package/dist/versions/v5/common/organization-getmembershiprequests-arguments-changed.md +1 -0
- package/dist/versions/v5/common/organization-getmemberships-arguments-changed.md +1 -0
- package/dist/versions/v5/common/organization-getpendinginvitations.md +11 -0
- package/dist/versions/v5/common/organization-getroles-arguments-changed.md +1 -0
- package/dist/versions/v5/common/organization-logourl.md +8 -0
- package/dist/versions/v5/common/organizationmembershippublicuserdata-profileimageurl.md +7 -0
- package/dist/versions/v5/common/organizationprofile-settings.md +1 -0
- package/dist/versions/v5/common/organizationswitcherpopoveractionbuttontext-removed.md +1 -0
- package/dist/versions/v5/common/remove-identitypreview-avatar.md +1 -0
- package/dist/versions/v5/common/remove-socialbuttonsblockbuttonarrow.md +1 -0
- package/dist/versions/v5/common/removed-localization-keys.md +74 -73
- package/dist/versions/v5/common/user-getorganizationinvitations-arguments-chanaged.md +1 -0
- package/dist/versions/v5/common/user-getorganizationinvitations-arguments-changed.md +16 -0
- package/dist/versions/v5/common/user-getorganizationmemberships-arguments-chanaged.md +1 -0
- package/dist/versions/v5/common/user-getorganizationmemberships-arguments-changed.md +16 -0
- package/dist/versions/v5/common/user-getorganizationsuggestions-arguments-chanaged.md +1 -0
- package/dist/versions/v5/common/user-getorganizationsuggestions-arguments-changed.md +16 -0
- package/dist/versions/v5/common/user-profileimageurl.md +7 -0
- package/dist/versions/v5/common/user-update-password.md +18 -0
- package/dist/versions/v5/common/userbuttonpopoveractionbuttontext-removed.md +1 -0
- package/dist/versions/v5/common/userbuttontrigger-userbuttonbox-invert.md +2 -1
- package/dist/versions/v5/common/userprofile-security.md +1 -0
- package/dist/versions/v5/common/withclerk-hof-removed.md +15 -14
- package/dist/versions/v5/common/withclerk-removed.md +1 -0
- package/dist/versions/v5/common/withsession-hof-removed.md +15 -14
- package/dist/versions/v5/common/withsession-removed.md +1 -0
- package/dist/versions/v5/common/withuser-hof-removed.md +15 -14
- package/dist/versions/v5/common/withuser-removed-2.md +1 -2
- package/dist/versions/v5/expo/apikey-to-publishable-key.md +1 -0
- package/dist/versions/v5/expo/clerkprovider-frontendapi.md +1 -0
- package/dist/versions/v5/fastify/clerkplugin-frontendapi.md +2 -1
- package/dist/versions/v5/fastify/createclerkclient-apikey.md +1 -0
- package/dist/versions/v5/fastify/createclerkclient-frontendapi.md +1 -0
- package/dist/versions/v5/gatsby/api-url-value-change.md +1 -1
- package/dist/versions/v5/gatsby/apikey-to-publishable-key.md +1 -0
- package/dist/versions/v5/gatsby/createclerkclient-apikey.md +1 -0
- package/dist/versions/v5/gatsby/createclerkclient-frontendapi.md +1 -0
- package/dist/versions/v5/gatsby/withserverauth-return-type.md +22 -30
- package/dist/versions/v5/index.js +16 -26
- package/dist/versions/v5/js/experimental-canusecaptcha.md +1 -0
- package/dist/versions/v5/js/experimental-captchasitekey.md +1 -0
- package/dist/versions/v5/js/experimental-captchaurl.md +1 -0
- package/dist/versions/v5/js/getorganizationmemberships.md +3 -6
- package/dist/versions/v5/js/redirecttohome.md +4 -4
- package/dist/versions/v5/js/signup-attemptweb3walletverification-generatedsignature.md +3 -2
- package/dist/versions/v5/js/unstable-invitationupdate.md +1 -0
- package/dist/versions/v5/js/unstable-membershipupdate.md +1 -0
- package/dist/versions/v5/js/user-createexternalaccount-redirecturl.md +1 -0
- package/dist/versions/v5/js/user-update-password.md +8 -9
- package/dist/versions/v5/next/auth-import-change.md +1 -0
- package/dist/versions/v5/next/auth-middleware-deprecated.md +8 -7
- package/dist/versions/v5/next/authmiddleware-apikey.md +5 -7
- package/dist/versions/v5/next/authmiddleware-frontendapi.md +2 -1
- package/dist/versions/v5/next/authmiddleware-import-change.md +1 -0
- package/dist/versions/v5/next/buildclerkprops-import-change.md +1 -0
- package/dist/versions/v5/next/clerk-import-change.md +1 -0
- package/dist/versions/v5/next/clerk-js-version-next-public.md +1 -0
- package/dist/versions/v5/next/constants-import-change.md +2 -1
- package/dist/versions/v5/next/createauthenticaterequest-import-change.md +1 -0
- package/dist/versions/v5/next/createclerkclient-apikey.md +2 -1
- package/dist/versions/v5/next/createclerkclient-frontendapi.md +2 -1
- package/dist/versions/v5/next/createisomorphicrequest-import-change.md +1 -0
- package/dist/versions/v5/next/currentuser-import-change.md +1 -0
- package/dist/versions/v5/next/decodejwt-import-change.md +1 -0
- package/dist/versions/v5/next/emaillinkerrorcode-import-change.md +1 -0
- package/dist/versions/v5/next/getauth-apikey.md +2 -1
- package/dist/versions/v5/next/import-api-url.md +2 -1
- package/dist/versions/v5/next/import-api-version.md +2 -1
- package/dist/versions/v5/next/import-clerk-js-url.md +2 -1
- package/dist/versions/v5/next/import-clerk-js-version.md +2 -1
- package/dist/versions/v5/next/import-domain.md +2 -1
- package/dist/versions/v5/next/import-is-satellite.md +2 -1
- package/dist/versions/v5/next/import-nextjs-api.md +7 -6
- package/dist/versions/v5/next/import-nextjs-app-beta.md +2 -1
- package/dist/versions/v5/next/import-nextjs-edge-middleware.md +1 -0
- package/dist/versions/v5/next/import-nextjs-edge-middlewarefiles.md +1 -0
- package/dist/versions/v5/next/import-nextjs-ssr.md +1 -0
- package/dist/versions/v5/next/import-proxy-url.md +2 -1
- package/dist/versions/v5/next/import-publishable-key.md +2 -1
- package/dist/versions/v5/next/import-secret-key.md +2 -1
- package/dist/versions/v5/next/import-sign-in-url.md +2 -1
- package/dist/versions/v5/next/import-sign-up-url.md +2 -1
- package/dist/versions/v5/next/isclerkapiresponserror-import-change.md +1 -0
- package/dist/versions/v5/next/isemaillinkerror-import-change.md +1 -0
- package/dist/versions/v5/next/isknownerror-import-change.md +1 -0
- package/dist/versions/v5/next/ismetamaskerror-import-change.md +1 -0
- package/dist/versions/v5/next/min-nextjs-version.md +2 -0
- package/dist/versions/v5/next/multisessionappsupport-import-change.md +1 -0
- package/dist/versions/v5/next/next-public-clerk-js-url.md +2 -1
- package/dist/versions/v5/next/redirect-import-change.md +1 -0
- package/dist/versions/v5/next/redirecttosignin-import-path.md +2 -1
- package/dist/versions/v5/next/redirecttosignup-import-path.md +2 -1
- package/dist/versions/v5/next/signjwt-import-change.md +1 -0
- package/dist/versions/v5/next/verifyjwt-import-change.md +1 -0
- package/dist/versions/v5/next/verifytoken-import-change.md +1 -0
- package/dist/versions/v5/next/with-clerk-middleware-removed.md +1 -0
- package/dist/versions/v5/nextjs/api-url-value-change.md +8 -0
- package/dist/versions/v5/nextjs/auth-import-change.md +14 -0
- package/dist/versions/v5/nextjs/auth-middleware-deprecated.md +50 -0
- package/dist/versions/v5/nextjs/authmiddleware-apikey.md +15 -0
- package/dist/versions/v5/nextjs/authmiddleware-frontendapi.md +15 -0
- package/dist/versions/v5/nextjs/authmiddleware-import-change.md +14 -0
- package/dist/versions/v5/nextjs/buildclerkprops-import-change.md +14 -0
- package/dist/versions/v5/nextjs/clerk-import-change.md +13 -0
- package/dist/versions/v5/nextjs/clerk-js-version-next-public.md +9 -0
- package/dist/versions/v5/nextjs/constants-import-change.md +14 -0
- package/dist/versions/v5/nextjs/createauthenticaterequest-import-change.md +14 -0
- package/dist/versions/v5/nextjs/createclerkclient-apikey.md +15 -0
- package/dist/versions/v5/nextjs/createclerkclient-frontendapi.md +15 -0
- package/dist/versions/v5/nextjs/createisomorphicrequest-import-change.md +14 -0
- package/dist/versions/v5/nextjs/currentuser-import-change.md +14 -0
- package/dist/versions/v5/nextjs/decodejwt-import-change.md +14 -0
- package/dist/versions/v5/nextjs/emaillinkerrorcode-import-change.md +14 -0
- package/dist/versions/v5/nextjs/getauth-apikey.md +13 -0
- package/dist/versions/v5/nextjs/import-api-url.md +8 -0
- package/dist/versions/v5/nextjs/import-api-version.md +8 -0
- package/dist/versions/v5/nextjs/import-clerk-js-url.md +8 -0
- package/dist/versions/v5/nextjs/import-clerk-js-version.md +8 -0
- package/dist/versions/v5/nextjs/import-domain.md +8 -0
- package/dist/versions/v5/nextjs/import-is-satellite.md +8 -0
- package/dist/versions/v5/nextjs/import-nextjs-api.md +21 -0
- package/dist/versions/v5/nextjs/import-nextjs-app-beta.md +11 -0
- package/dist/versions/v5/nextjs/import-nextjs-edge-middleware.md +7 -0
- package/dist/versions/v5/nextjs/import-nextjs-edge-middlewarefiles.md +7 -0
- package/dist/versions/v5/nextjs/import-nextjs-ssr.md +8 -0
- package/dist/versions/v5/nextjs/import-proxy-url.md +8 -0
- package/dist/versions/v5/nextjs/import-publishable-key.md +8 -0
- package/dist/versions/v5/nextjs/import-secret-key.md +8 -0
- package/dist/versions/v5/nextjs/import-sign-in-url.md +8 -0
- package/dist/versions/v5/nextjs/import-sign-up-url.md +8 -0
- package/dist/versions/v5/nextjs/isclerkapiresponserror-import-change.md +14 -0
- package/dist/versions/v5/nextjs/isemaillinkerror-import-change.md +14 -0
- package/dist/versions/v5/nextjs/isknownerror-import-change.md +14 -0
- package/dist/versions/v5/nextjs/min-nextjs-version.md +11 -0
- package/dist/versions/v5/nextjs/multisessionappsupport-import-change.md +14 -0
- package/dist/versions/v5/nextjs/next-public-clerk-js-url.md +7 -0
- package/dist/versions/v5/nextjs/redirect-import-change.md +14 -0
- package/dist/versions/v5/nextjs/redirecttosignin-import-path.md +13 -0
- package/dist/versions/v5/nextjs/redirecttosignup-import-path.md +13 -0
- package/dist/versions/v5/nextjs/signjwt-import-change.md +14 -0
- package/dist/versions/v5/nextjs/verifyjwt-import-change.md +14 -0
- package/dist/versions/v5/nextjs/verifytoken-import-change.md +14 -0
- package/dist/versions/v5/nextjs/with-clerk-middleware-removed.md +56 -0
- package/dist/versions/v5/node/cjs-esm-instance.md +1 -0
- package/dist/versions/v5/node/clerkexpressrequireauth-apikey.md +1 -0
- package/dist/versions/v5/node/clerkexpressrequireauth-frontendapi.md +1 -0
- package/dist/versions/v5/node/clerkexpresswithauth-apikey.md +1 -0
- package/dist/versions/v5/node/clerkexpresswithauth-frontendapi.md +1 -0
- package/dist/versions/v5/node/createclerkclient-apikey.md +1 -0
- package/dist/versions/v5/node/createclerkclient-frontendapi.md +1 -0
- package/dist/versions/v5/node/createclerkexpressrequireauth-apikey.md +1 -0
- package/dist/versions/v5/node/createclerkexpressrequireauth-frontendapi.md +1 -0
- package/dist/versions/v5/node/createclerkexpresswithauth-apikey.md +1 -0
- package/dist/versions/v5/node/createclerkexpresswithauth-frontendapi.md +1 -0
- package/dist/versions/v5/node/legacyauthobject-removed.md +3 -3
- package/dist/versions/v5/node/setclerkapikey.md +1 -0
- package/dist/versions/v5/node/setclerkapiversion.md +1 -0
- package/dist/versions/v5/node/setclerkhttpoptions.md +1 -0
- package/dist/versions/v5/node/setclerkserverapiurl.md +1 -0
- package/dist/versions/v5/react/api-url-value-change.md +1 -1
- package/dist/versions/v5/remix/clerk-import-change.md +1 -0
- package/dist/versions/v5/remix/clerkerrorboundary-removed.md +1 -0
- package/dist/versions/v5/remix/createclerkclient-apikey.md +1 -0
- package/dist/versions/v5/remix/getauth-apikey.md +1 -0
- package/dist/versions/v5/remix/rootauthloader-apikey.md +1 -0
- package/dist/versions/v5/remix/rootauthloader-frontendapi.md +1 -0
- package/package.json +5 -2
|
@@ -0,0 +1,1091 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Upgrading Next.js to Core 2"
|
|
3
|
+
description: "Learn how to upgrade Clerk's Next.js SDK to the latest version."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Upgrading `@clerk/nextjs` to Core 2
|
|
7
|
+
|
|
8
|
+
Clerk's Core 2 release includes a new major version of the Next.js SDK, v5. This new version ships with an improved design and UX for its built-in components, no "flash of white page" when authenticating, a substantially improved middleware import, and a variety of smaller DX improvements and housekeeping items. Each of the potentially breaking changes are detailed in this guide, below.
|
|
9
|
+
|
|
10
|
+
By the end of this guide, you’ll have successfully upgraded your Next.js project to use `@clerk/nextjs` v5. You’ll learn how to update your dependencies, resolve breaking changes, and find deprecations. Step-by-step instructions will lead you through the process.
|
|
11
|
+
|
|
12
|
+
## Preparing to upgrade
|
|
13
|
+
|
|
14
|
+
Before uprading, it's highly recommended that you update your Clerk SDKs to the latest Core 1 version (`npm i @clerk/nextjs@core-1`). Some changes required for Core 2 can be applied incrementally to the latest v5 release, which should contribute to a smoother upgrading experience.
|
|
15
|
+
|
|
16
|
+
After updating, look out for deprecation messages in your terminal and browser console. By resolving these deprecations you'll be able to skip many breaking changes from Core 2.
|
|
17
|
+
|
|
18
|
+
<Callout>
|
|
19
|
+
Note that Core 2 is currently in beta, while we field feedback and ensure stability. Deploying beta versions to
|
|
20
|
+
production is not recommended and should be done at your own risk.
|
|
21
|
+
</Callout>
|
|
22
|
+
|
|
23
|
+
Additionally, some of the minumum version requirements for some base dependencies have been updated such that versions that are no longer supported or are at end-of-life are no longer guaranteed to work correctly with Clerk.
|
|
24
|
+
|
|
25
|
+
**Updating Node.js**
|
|
26
|
+
|
|
27
|
+
You need to have Node.js `18.17.0` or later installed. Last year, Node.js 16 entered EOL (End of life) status, so support for this version has been removed across Clerk SDKs. You can check your Node.js version by running `node -v` in your terminal. Learn more about how to [update and install Node.js](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs).
|
|
28
|
+
|
|
29
|
+
**Updating React**
|
|
30
|
+
|
|
31
|
+
All react-dependent Clerk SDKs now require you to use React 18 or higher. You can update your project by installing the latest version of `react` and `react-dom`.
|
|
32
|
+
|
|
33
|
+
<CodeBlockTabs type="installer" options={["npm", "yarn", "pnpm"]}>
|
|
34
|
+
```bash filename="terminal"
|
|
35
|
+
npm install react@latest react-dom@latest
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```bash filename="terminal"
|
|
39
|
+
yarn add react@latest react-dom@latest
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```bash filename="terminal"
|
|
43
|
+
pnpm add react@latest react-dom@latest
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
</CodeBlockTabs>
|
|
47
|
+
|
|
48
|
+
If you are upgrading from React 17 or lower, make sure to [learn about how to upgrade your React version to 18](https://react.dev/blog/2022/03/08/react-18-upgrade-guide) as well.
|
|
49
|
+
|
|
50
|
+
**Updating Next.js**
|
|
51
|
+
|
|
52
|
+
`@clerk/nextjs` now requires you to use Next.js version `13.0.4` or later. Check out Next's upgrade guides for more guidance if you have not yet upgraded to Next.js 13:
|
|
53
|
+
|
|
54
|
+
- [Upgrading from 12 to 13](https://nextjs.org/docs/pages/building-your-application/upgrading/version-13)
|
|
55
|
+
- [Upgrading from 13 to 14](https://nextjs.org/docs/app/building-your-application/upgrading/version-14)
|
|
56
|
+
|
|
57
|
+
## Updating to Core 2 Beta
|
|
58
|
+
|
|
59
|
+
Whenever you feel ready, go ahead and install the latest beta version of any Clerk SDKs you are using. Make sure that you are prepared to patch some breaking changes before your app will work properly, however. The commands below demonstrate how to install the latest beta.
|
|
60
|
+
|
|
61
|
+
<CodeBlockTabs type="installer" options={["npm", "yarn", "pnpm"]}>
|
|
62
|
+
```bash filename="terminal"
|
|
63
|
+
npm install @clerk/nextjs@beta
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```bash filename="terminal"
|
|
67
|
+
yarn add @clerk/nextjs@beta
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```bash filename="terminal"
|
|
71
|
+
pnpm add @clerk/nextjs@beta
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
</CodeBlockTabs>
|
|
75
|
+
|
|
76
|
+
## CLI Upgrade Helper
|
|
77
|
+
|
|
78
|
+
As of this major version Clerk provides a `@clerk/upgrade` CLI tool that you can use to ease the upgrade. A CLI prompt will ask you a couple of questions, it will scan your codebase, and afterwards you'll get a list of changes you'll need to apply to your project, as well as the locations where they need to be applied. This should catch the vast majority of the changes needed for a successful upgrade, and can save a lot of time reading through changes to things that aren't actually in your project.
|
|
79
|
+
|
|
80
|
+
To run the CLI tool, navigate to your project and run it in the terminal:
|
|
81
|
+
|
|
82
|
+
<CodeBlockTabs type="installer" options={["npm", "yarn", "pnpm"]}>
|
|
83
|
+
```bash filename="terminal"
|
|
84
|
+
npx @clerk/upgrade
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```bash filename="terminal"
|
|
88
|
+
yarn dlx @clerk/upgrade
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```bash filename="terminal"
|
|
92
|
+
pnpm dlx @clerk/upgrade
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
</CodeBlockTabs>
|
|
96
|
+
|
|
97
|
+
If you are having trouble with `npx`, it's also possible to install directly with `npm i @clerk/upgrade -g`, and can then be run with the `clerk-upgrade` command.
|
|
98
|
+
|
|
99
|
+
## Breaking Changes
|
|
100
|
+
|
|
101
|
+
### Component design adjustments
|
|
102
|
+
|
|
103
|
+
The new version ships with improved design and UX across all of Clerk's [UI components](/docs/components/overview). If you have used the [`appearance` prop](/docs/components/customization/overview) or tokens for a [custom theme](/docs/components/customization/overview#create-a-custom-theme), you will likely need to make some adjustments to ensure your styling is still looking great. If you're using the [localization prop](/docs/components/customization/localization) you will likely need to make adjustments to account for added or removed localization keys.
|
|
104
|
+
|
|
105
|
+
[More detail on these changes »](/components-redesigned)
|
|
106
|
+
|
|
107
|
+
## New Middleware architecture
|
|
108
|
+
|
|
109
|
+
User and customer feedback about `authMiddleware()` has been clear in that Middleware logic was a often friction point. As such, in v5 you will find a completely new Middleware helper called [`clerkMiddleware()`](/docs/references/nextjs/clerk-middleware) that will hopefully alleviate all of the issues folks had with `authMiddleware()`.
|
|
110
|
+
|
|
111
|
+
Additionally, there are now new helpers that enable controlling auth on a _per-page and/or per-layout basis_ when using App Router. While you can still configure which routes are protected via Middleware, the page-based protection strategy is what is now recommended, as the co-location of auth protection configuration with the code for the pages themselves results in a superior developer experience that adds clarity as you navigate your codebase.
|
|
112
|
+
|
|
113
|
+
### Per-route auth config
|
|
114
|
+
|
|
115
|
+
Sometimes, code speaks louder than words. Let's get right into an example:
|
|
116
|
+
|
|
117
|
+
<Tabs type="auth-protect-layout-page" items={["Layout", "Page"]}>
|
|
118
|
+
<Tab>
|
|
119
|
+
```ts filename="app/src/dashboard/layout.tsx"
|
|
120
|
+
import { auth } from '@clerk/nextjs/server'
|
|
121
|
+
|
|
122
|
+
export default async function DashboardLayout({ children }) {
|
|
123
|
+
auth().protect();
|
|
124
|
+
// 👆 This one line is all it takes - the layout and all its children
|
|
125
|
+
// will now redirect to your sign in page for un-authenticated users.
|
|
126
|
+
|
|
127
|
+
return <>{children}</>
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
````
|
|
132
|
+
</Tab>
|
|
133
|
+
<Tab>
|
|
134
|
+
```ts filename="app/src/dashboard/page.tsx"
|
|
135
|
+
import { auth } from '@clerk/nextjs/server'
|
|
136
|
+
|
|
137
|
+
export default async function DashboardPage() {
|
|
138
|
+
auth().protect();
|
|
139
|
+
// 👆 This one line is all it takes - the layout and all its children
|
|
140
|
+
// will now redirect to your sign in page for un-authenticated users.
|
|
141
|
+
|
|
142
|
+
return <p>This page is now protected!</p>
|
|
143
|
+
}
|
|
144
|
+
````
|
|
145
|
+
|
|
146
|
+
</Tab>
|
|
147
|
+
</Tabs>
|
|
148
|
+
|
|
149
|
+
In this example, we add `auth().protect()` to a layout, and like magic, that layout and all of it's children will be gated by auth. The same logic can be applied for pages.
|
|
150
|
+
|
|
151
|
+
Want to get more specific with permission gating? Add the role you are gating as a param:
|
|
152
|
+
|
|
153
|
+
```ts filename="app/src/admin/layout.tsx"
|
|
154
|
+
import { auth } from '@clerk/nextjs/server';
|
|
155
|
+
|
|
156
|
+
export default async function AdminLayout({ children }) {
|
|
157
|
+
auth().protect({ role: 'org:admin' });
|
|
158
|
+
|
|
159
|
+
return <>{children}</>;
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Note that in order for this to work, you will still need Middleware to be present, but it only requires the most minimal configuration:
|
|
164
|
+
|
|
165
|
+
```ts filename="middleware.ts"
|
|
166
|
+
import { clerkMiddleware } from '@clerk/nextjs/server';
|
|
167
|
+
|
|
168
|
+
export default clerkMiddleware();
|
|
169
|
+
|
|
170
|
+
export const config = {
|
|
171
|
+
matcher: ['/((?!.*\\..*|_next).*)', '/', '/(api|trpc)(.*)'],
|
|
172
|
+
};
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
If you are using the pages router, per-route gating won't work. Instead, configure your auth gating via Middleware as described in the next section.
|
|
176
|
+
|
|
177
|
+
### Middleware auth config
|
|
178
|
+
|
|
179
|
+
If you prefer to define your auth logic within the Middleware, you can still do this using the new `clerkMiddleware`. The primary change from the previous `authMiddleware()` is that `clerkMiddleware()` does not protect any routes by default, instead requiring the developer to add routes they would like to be protected by auth. This is a substantial contrast to the previous `authMiddleware()`, which protected all routes by default, requiring the developer to add exceptions. The API was also substantially simplified, and it has become easier to combine with other Middleware helpers smoothly as well.
|
|
180
|
+
|
|
181
|
+
Here's an example that replicates the auth protection scheme above, but entirely inside the Middleware:
|
|
182
|
+
|
|
183
|
+
```ts filename="middleware.ts"
|
|
184
|
+
import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server';
|
|
185
|
+
|
|
186
|
+
const isDashboardRoute = createRouteMatcher(['/dashboard(.*)']);
|
|
187
|
+
const isAdminRoute = createRouteMatcher(['/admin']);
|
|
188
|
+
|
|
189
|
+
export default clerkMiddleware((auth, req) => {
|
|
190
|
+
// Restrict admin route to users with specific role
|
|
191
|
+
if (isAdminRoute(req)) auth().protect({ role: 'org:admin' });
|
|
192
|
+
|
|
193
|
+
// Restrict dashboard routes to logged in users
|
|
194
|
+
if (isDashboardRoute(req)) auth().protect();
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
export const config = {
|
|
198
|
+
matcher: ['/((?!.*\\..*|_next).*)', '/', '/(api|trpc)(.*)'],
|
|
199
|
+
};
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
A couple things to note here:
|
|
203
|
+
|
|
204
|
+
- The `createRouteMatcher` helper makes it easy to define route groups that you can leverage inside the Middleware function and check in whichever order you'd like. Note that it can take an array of routes as well.
|
|
205
|
+
- With `clerkMiddleware`, you're defining the routes you want **to be protected**, rather than the routes you don't want to be protected.
|
|
206
|
+
- You are able to use the same `auth().protect()` helpers that you can use within layouts/pages here in the Middleware.
|
|
207
|
+
|
|
208
|
+
### Migrating to `clerkMiddleware()`
|
|
209
|
+
|
|
210
|
+
Clerk strongly recommends migrating to the new `clerkMiddleware()` for an improved DX and access to all present and upcoming features, but also want to note that `authMiddleware()`, while deprecated, will continue to work in v5 and will not be removed until the next major version, so you do not _need_ to make any changes to your Middleware setup this version.
|
|
211
|
+
|
|
212
|
+
The most basic migration will be updating the import and changing out the default export.
|
|
213
|
+
|
|
214
|
+
```diff
|
|
215
|
+
- import { authMiddleware } from "@clerk/nextjs"
|
|
216
|
+
+ import { clerkMiddleware } from '@clerk/nextjs/server'
|
|
217
|
+
|
|
218
|
+
- export default authMiddleware()
|
|
219
|
+
+ export default clerkMiddleware()
|
|
220
|
+
|
|
221
|
+
export const config = {
|
|
222
|
+
matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Of course, in most cases you'll have a more complicated setup than this. You can find some examples below for how to migrate a few common use cases. Be sure to review the [`clerkMiddleware()` documentation](/docs/references/nextjs/clerk-middleware) and [route protection guide](/docs/references/nextjs/route-protection) if your specific use case is not mentioned.
|
|
227
|
+
|
|
228
|
+
<Accordion titles={["Making the index page public", "Protecting a single route path", "Combining with other Middlewares (like i18n)"]} heading="h4">
|
|
229
|
+
<AccordionPanel>
|
|
230
|
+
By default, `clerkMiddleware()` treats all pages as public, so you no longer need to explcitly set `/` as public.
|
|
231
|
+
|
|
232
|
+
Before:
|
|
233
|
+
|
|
234
|
+
```ts filename="middleware.ts"
|
|
235
|
+
import { authMiddleware } from "@clerk/nextjs"
|
|
236
|
+
|
|
237
|
+
export default authMiddleware({
|
|
238
|
+
publicRoutes: ["/"],
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
export const config = {
|
|
242
|
+
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
After:
|
|
247
|
+
|
|
248
|
+
```ts filename="middleware.ts"
|
|
249
|
+
import {
|
|
250
|
+
clerkMiddleware,
|
|
251
|
+
createRouteMatcher
|
|
252
|
+
} from "@clerk/nextjs/server"
|
|
253
|
+
|
|
254
|
+
export default clerkMiddleware()
|
|
255
|
+
|
|
256
|
+
export const config = {
|
|
257
|
+
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
</AccordionPanel>
|
|
262
|
+
<AccordionPanel>
|
|
263
|
+
Having all routes public except everything under `/dashboard`.
|
|
264
|
+
|
|
265
|
+
Before:
|
|
266
|
+
|
|
267
|
+
```ts filename="middleware.ts"
|
|
268
|
+
import { authMiddleware } from "@clerk/nextjs"
|
|
269
|
+
|
|
270
|
+
export default authMiddleware({
|
|
271
|
+
publicRoutes: (req) => !req.url.includes("/dashboard"),
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
export const config = {
|
|
275
|
+
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
After:
|
|
280
|
+
|
|
281
|
+
```ts filename="middleware.ts"
|
|
282
|
+
import {
|
|
283
|
+
clerkMiddleware,
|
|
284
|
+
createRouteMatcher
|
|
285
|
+
} from "@clerk/nextjs/server"
|
|
286
|
+
|
|
287
|
+
const isDashboardRoute = createRouteMatcher(["/dashboard(.*)"])
|
|
288
|
+
|
|
289
|
+
export default clerkMiddleware((auth, request) => {
|
|
290
|
+
if (isDashboardRoute(request)) {
|
|
291
|
+
auth().protect()
|
|
292
|
+
}
|
|
293
|
+
})
|
|
294
|
+
|
|
295
|
+
export const config = {
|
|
296
|
+
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
</AccordionPanel>
|
|
301
|
+
<AccordionPanel>
|
|
302
|
+
You can call other Middlewares inside `clerkMiddleware()`, giving you more direct control over what is called where. An example would be [next-intl](https://next-intl-docs.vercel.app/) to add internationalization to your app.
|
|
303
|
+
|
|
304
|
+
Before:
|
|
305
|
+
|
|
306
|
+
```ts filename="middleware.ts"
|
|
307
|
+
import { authMiddleware } from "@clerk/nextjs"
|
|
308
|
+
import createMiddleware from "next-intl/middleware"
|
|
309
|
+
|
|
310
|
+
const intlMiddleware = createMiddleware({
|
|
311
|
+
locales: ["en", "de"],
|
|
312
|
+
defaultLocale: "en",
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
export default authMiddleware({
|
|
316
|
+
beforeAuth: (req) => {
|
|
317
|
+
return intlMiddleware(req);
|
|
318
|
+
},
|
|
319
|
+
publicRoutes: ["((?!^/dashboard/).*)"],
|
|
320
|
+
})
|
|
321
|
+
|
|
322
|
+
export const config = {
|
|
323
|
+
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
After:
|
|
328
|
+
|
|
329
|
+
```ts filename="middleware.ts"
|
|
330
|
+
import {
|
|
331
|
+
clerkMiddleware,
|
|
332
|
+
createRouteMatcher
|
|
333
|
+
} from "@clerk/nextjs/server"
|
|
334
|
+
import createMiddleware from "next-intl/middleware"
|
|
335
|
+
|
|
336
|
+
const intlMiddleware = createMiddleware({
|
|
337
|
+
locales: ["en", "de"],
|
|
338
|
+
defaultLocale: "en",
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
const isDashboardRoute = createRouteMatcher(["/dashboard(.*)"])
|
|
342
|
+
|
|
343
|
+
export default clerkMiddleware((auth, request) => {
|
|
344
|
+
if (isDashboardRoute(request)) {
|
|
345
|
+
auth().protect()
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return intlMiddleware(request)
|
|
349
|
+
})
|
|
350
|
+
|
|
351
|
+
export const config = {
|
|
352
|
+
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
</AccordionPanel>
|
|
357
|
+
</Accordion>
|
|
358
|
+
|
|
359
|
+
## Changes to top-level exports
|
|
360
|
+
|
|
361
|
+
As part of this release, some of the top-level exports of `@clerk/nextjs` have been changed in order to improve bundle size and tree-shaking efficiency. These changes have resulted in a ~75% reduction in build size for middleware bundles. However, you will likely need to make some changes to import paths as a result.
|
|
362
|
+
|
|
363
|
+
<Callout type='info'>
|
|
364
|
+
Use [the CLI tool](#cli-upgrade-helper) to automatically find occurences of imports that need to be changed.
|
|
365
|
+
</Callout>
|
|
366
|
+
|
|
367
|
+
<Accordion titles={["@clerk/nextjs/server", "@clerk/nextjs/errors", "@clerk/nextjs/app-beta", "@clerk/nextjs/ssr", "@clerk/nextjs/edge-middleware", "@clerk/nextjs/edge-middlewarefiles", "@clerk/nextjs/api"]} heading="h4">
|
|
368
|
+
<AccordionPanel>
|
|
369
|
+
Previously these exports have been exported both from `@clerk/nextjs` and `@clerk/nextjs/server`. As of v5 they are only exported from the latter.
|
|
370
|
+
|
|
371
|
+
```diff
|
|
372
|
+
import {
|
|
373
|
+
auth,
|
|
374
|
+
currentUser,
|
|
375
|
+
authMiddleware,
|
|
376
|
+
buildClerkProps,
|
|
377
|
+
verifyToken,
|
|
378
|
+
verifyJwt,
|
|
379
|
+
decodeJwt,
|
|
380
|
+
signJwt,
|
|
381
|
+
constants,
|
|
382
|
+
redirect,
|
|
383
|
+
createAuthenticateRequest,
|
|
384
|
+
createIsomorphicRequest,
|
|
385
|
+
- } from "@clerk/nextjs"
|
|
386
|
+
+ } from "@clerk/nextjs/server"
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
</AccordionPanel>
|
|
390
|
+
<AccordionPanel>
|
|
391
|
+
Exports related to errors are now under `@clerk/nextjs/errors`.
|
|
392
|
+
|
|
393
|
+
```diff
|
|
394
|
+
import {
|
|
395
|
+
isClerkAPIResponseError,
|
|
396
|
+
isEmailLinkError,
|
|
397
|
+
isKnownError,
|
|
398
|
+
isMetamaskError,
|
|
399
|
+
EmailLinkErrorCode,
|
|
400
|
+
- } from "@clerk/nextjs"
|
|
401
|
+
+ } from "@clerk/nextjs/errors"
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
</AccordionPanel>
|
|
405
|
+
<AccordionPanel>
|
|
406
|
+
The `@clerk/nextjs` import will work with both the app and pages router.
|
|
407
|
+
|
|
408
|
+
```diff
|
|
409
|
+
- import { } from "@clerk/nextjs/app-beta"
|
|
410
|
+
+ import { } from "@clerk/nextjs"
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
Some behavior may have changed between Clerk's beta and the stable release. Please check on your end if behavior stayed the same.
|
|
414
|
+
|
|
415
|
+
</AccordionPanel>
|
|
416
|
+
<AccordionPanel>
|
|
417
|
+
The top-level exports support SSR by default now.
|
|
418
|
+
|
|
419
|
+
```diff
|
|
420
|
+
- import { } from "@clerk/nextjs/ssr"
|
|
421
|
+
+ import { } from "@clerk/nextjs"
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
</AccordionPanel>
|
|
425
|
+
<AccordionPanel>
|
|
426
|
+
```diff
|
|
427
|
+
- import { } from "@clerk/nextjs/edge-middleware"
|
|
428
|
+
+ import { } from "@clerk/nextjs"
|
|
429
|
+
```
|
|
430
|
+
</AccordionPanel>
|
|
431
|
+
<AccordionPanel>
|
|
432
|
+
```diff
|
|
433
|
+
- import { } from "@clerk/nextjs/edge-middlewarefiles"
|
|
434
|
+
+ import { } from "@clerk/nextjs"
|
|
435
|
+
```
|
|
436
|
+
</AccordionPanel>
|
|
437
|
+
<AccordionPanel>
|
|
438
|
+
The `@clerk/nextjs/api` subpath was removed completely. It re-exported helpers from `@clerk/clerk-sdk-node` and its types. If you relied on these, import from `@clerk/clerk-sdk-node` directly instead.
|
|
439
|
+
|
|
440
|
+
```diff
|
|
441
|
+
import type {
|
|
442
|
+
ClerkMiddleware,
|
|
443
|
+
ClerkMiddlewareOptions,
|
|
444
|
+
LooseAuthProp,
|
|
445
|
+
RequireAuthProp,
|
|
446
|
+
StrictAuthProp,
|
|
447
|
+
WithAuthProp
|
|
448
|
+
- } from "@clerk/nextjs/api"
|
|
449
|
+
+ } from "@clerk/clerk-sdk-node"
|
|
450
|
+
|
|
451
|
+
- import { requireAuth, withAuth } from "@clerk/nextjs/api"
|
|
452
|
+
+ import { requireAuth, withAuth } from "@clerk/clerk-sdk-node"
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
</AccordionPanel>
|
|
456
|
+
</Accordion>
|
|
457
|
+
|
|
458
|
+
### After sign up/in/out URL handling
|
|
459
|
+
|
|
460
|
+
Defining redirect URLs for after sign up, in, and/or out via the Clerk dashboard has been removed in Core 2. In your Clerk dashboard, under "paths", there is a section called "Component paths", where URLs could be defined that had a deprecation warning. In Core 2, this functionality has been removed, and specifying redirect paths via the dashboard will no longer work. If you need to pass a redirect URL for after sign in/up/out, there are [a few different ways this can be done](https://clerk.com/docs/account-portal/custom-redirects), from environment variables to middleware to supplying them directly to the relevant components.
|
|
461
|
+
|
|
462
|
+
As part of this change, the default URL for each of these props has been set to `/`, so if you are passing `/` explicitly to any one of the above props, that line is no longer necessary and can be removed.
|
|
463
|
+
|
|
464
|
+
```diff
|
|
465
|
+
- <UserButton afterSignOutUrl='/' />
|
|
466
|
+
+ <UserButton />
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### Removed: `orgs` claim on JWT
|
|
470
|
+
|
|
471
|
+
In the previous version of Clerk's SDKs, if you decode the session token that Clerk returns from the server, you'll currently find an `orgs` claim on it. It lists all the orgs associated with the given user. Now, Clerk returns the `org_id`, `org_slug`, and `org_role` of the **active** organization.
|
|
472
|
+
|
|
473
|
+
The `orgs` claim was part of the `JwtPayload`. Here are a few examples of where the `JwtPayload` could be found.
|
|
474
|
+
|
|
475
|
+
<Accordion titles={["Next.js", "Fastify", "@clerk/backend", "@clerk/clerk-sdk-node"]} heading="h5">
|
|
476
|
+
<AccordionPanel>
|
|
477
|
+
```typescript filename="Next.js"
|
|
478
|
+
import { getAuth } from "@clerk/nextjs/server"
|
|
479
|
+
const claims: JwtPayload = getAuth(request).sessionClaims
|
|
480
|
+
|
|
481
|
+
import { getAuth } from "@clerk/ssr.server"
|
|
482
|
+
const claims: JwtPayload = (await getAuth(request)).sessionClaims
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
</AccordionPanel>
|
|
486
|
+
<AccordionPanel>
|
|
487
|
+
```typescript filename="Fastify"
|
|
488
|
+
import { getAuth } from "@clerk/fastify"
|
|
489
|
+
const claims: JwtPayload = (await getAuth(request)).sessionClaims
|
|
490
|
+
```
|
|
491
|
+
</AccordionPanel>
|
|
492
|
+
<AccordionPanel>
|
|
493
|
+
```typescript filename="@clerk/backend"
|
|
494
|
+
import { createClerkClient } from "@clerk/backend"
|
|
495
|
+
|
|
496
|
+
const clerkClient = createClerkClient({ secretKey: "" })
|
|
497
|
+
const requestState = await clerkClient.authenticateRequest(
|
|
498
|
+
request,
|
|
499
|
+
{ publishableKey: "" }
|
|
500
|
+
)
|
|
501
|
+
const claims: JwtPayload = requestState.toAuth().sessionClaims
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
</AccordionPanel>
|
|
505
|
+
<AccordionPanel>
|
|
506
|
+
```typescript filename="@clerk/clerk-sdk-node"
|
|
507
|
+
import { clerkClient } from "@clerk/clerk-sdk-node"
|
|
508
|
+
|
|
509
|
+
router.use((...args) => clerkClient.expressRequireAuth()(...args))
|
|
510
|
+
router.get("/me", async (req, reply: Response) => {
|
|
511
|
+
return reply.json({ auth: req.auth })
|
|
512
|
+
})
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
</AccordionPanel>
|
|
516
|
+
</Accordion>
|
|
517
|
+
|
|
518
|
+
If you would like to have your JWT return all of the user's organizations, you can create a [custom JWT template](/docs/backend-requests/making/jwt-templates) in your dashboard. Add `{ "orgs": "user.organizations" }` to it.
|
|
519
|
+
|
|
520
|
+
### Path routing is now the default
|
|
521
|
+
|
|
522
|
+
On components like [`<SignIn />`](/docs/components/authentication/sign-in) you can define the props `routing` and `path`. `routing` can be set to `'hash' | 'path' | 'virtual'` and describes the routing strategy that should be used. `path` defines where the component is mounted when `routing="path"` is used.
|
|
523
|
+
|
|
524
|
+
In the latest version, the **default** `routing` strategy has become `'path'`. Unless you change the `routing` prop, you'll need to define the `path` prop. The affected components are:
|
|
525
|
+
|
|
526
|
+
- `<SignIn />`
|
|
527
|
+
- `<SignUp />`
|
|
528
|
+
- `<UserProfile />`
|
|
529
|
+
- `<CreateOrganization />`
|
|
530
|
+
- `<OrganizationProfile />`
|
|
531
|
+
|
|
532
|
+
Here's how you'd use the components going forward:
|
|
533
|
+
|
|
534
|
+
```jsx
|
|
535
|
+
<SignIn path="/sign-in" />
|
|
536
|
+
<SignUp path="/sign-up" />
|
|
537
|
+
<UserProfile path="/user-profile" />
|
|
538
|
+
<CreateOrganization path="/create-org" />
|
|
539
|
+
<OrganizationProfile path="/org-profile" />
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
If you don't define the `path` prop an error will be thrown. Of course, you can still use `routing="hash"` or `routing="virtual"`.
|
|
543
|
+
|
|
544
|
+
```jsx
|
|
545
|
+
<UserProfile routing="hash" />
|
|
546
|
+
<OrganizationProfile routing="virtual" />
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
For the @clerk/nextjs SDK, you can set environment variables for the sign up/in URLs and avoid needing to explicitly pass the path to the `<SignIn />` and `<SignUp />` components.
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
```env filename=".env.local"
|
|
555
|
+
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
|
|
556
|
+
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
If you have defined both environment variables, you're able to use the `<SignIn />` and `<SignUp />` components without any props, as such:
|
|
563
|
+
|
|
564
|
+
```jsx
|
|
565
|
+
<SignIn />
|
|
566
|
+
<SignUp />
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
### Image URL Name Consolidation
|
|
572
|
+
|
|
573
|
+
There are a number of Clerk primitives that contain images, and previously they each had different property names, like `avatarUrl`, `logoUrl`, `profileImageUrl`, etc. In order to promote consistency and make it simpler for developers to know where to find associated images, all image properties are now named `imageUrl`. See the list below for all affected classes:
|
|
574
|
+
|
|
575
|
+
<Accordion titles={["<code>Organization.logoUrl</code> -> <code>Organization.imageUrl</code>", "<code>User.profileImageUrl</code> -> <code>.imageUrl</code>", "<code>ExternalAccount.avatarUrl</code> -> <code>.imageUrl</code>", "<code>OrganizationMembershipPublicUserData.profileImageUrl</code> -> <code>.imageUrl</code>"]}>
|
|
576
|
+
<AccordionPanel>
|
|
577
|
+
The `logoUrl` property of any [`Organization` object](https://clerk.com/docs/references/javascript/organization/organization#organization) has been changed to `imageUrl`.
|
|
578
|
+
</AccordionPanel>
|
|
579
|
+
<AccordionPanel>
|
|
580
|
+
The `profileImageUrl` property of any `User` object has been changed to `imageUrl`.
|
|
581
|
+
</AccordionPanel>
|
|
582
|
+
<AccordionPanel>
|
|
583
|
+
The `avatarUrl` property of any [`ExternalAcccount` object](https://clerk.com/docs/references/javascript/external-account) has been changed to `imageUrl`.
|
|
584
|
+
</AccordionPanel>
|
|
585
|
+
<AccordionPanel>
|
|
586
|
+
The `profileImageUrl` property of any `OrganizationMembershipPublicUserData` object has been changed to `imageUrl`.
|
|
587
|
+
</AccordionPanel>
|
|
588
|
+
</Accordion>
|
|
589
|
+
|
|
590
|
+
### Deprecation removals & housekeeping
|
|
591
|
+
|
|
592
|
+
As part of this major version, a number of previously deprecated props, arugments, methods, etc have been removed. Additionally there have been some changes to things that are only used internally, or only used very rarely. It's highly unlikely that any given app will encounter any of these items, but they are all breaking changes, so they have all been documented below.
|
|
593
|
+
|
|
594
|
+
<Callout type='info'>
|
|
595
|
+
For this section more than any other one, please use the CLI upgrade tool (`npx @clerk/upgrade`). Changes in this
|
|
596
|
+
section are very unlikely to appear in your codebase, the tool will save time looking for them.
|
|
597
|
+
</Callout>
|
|
598
|
+
|
|
599
|
+
#### Deprecation removals
|
|
600
|
+
|
|
601
|
+
<Accordion titles={["<code>User.update({ password: 'x' })</code> -> <code>User.updatePassword('x')</code>", "<code>CLERK_API_KEY</code> replaced by <code>CLERK_SECRET_KEY</code>", "<code>CLERK_FRONTEND_API</code> replaced by <code>CLERK_PUBLISHABLE_KEY</code>", "<code>CLERK_JS_VERSION</code> should be <code>NEXT_PUBLIC_CLERK_JS_VERSION</code>", "<code>apiKey</code> -> <code>secretKey</code> as param to <code>authMiddleware</code>", "<code>frontendApi</code> -> <code>publishableKey</code> as param to <code>authMiddleware</code>", "<code>apiKey</code> -> <code>secretKey</code> as param to <code>createClerkClient</code>", "<code>frontendApi</code> -> <code>publishableKey</code> as param to <code>createClerkClient</code>", "<code>apiKey</code> -> <code>secretKey</code> as param to <code>getAuth</code>", "<code>frontendApi</code> -> <code>publishableKey</code> as prop to <code>ClerkProvider</code>", "<code>@clerk/nextjs/app-beta</code> import removed", "<code>@clerk/nextjs/ssr</code> import removed", "<code>@clerk/nextjs/edge-middleware</code> import removed", "<code>@clerk/nextjs/edge-middlewarefiles</code> import removed", "<code>API_URL</code> constant removed", "<code>API_VERSION</code> constant removed", "<code>CLERK_JS_URL</code> constant removed", "<code>CLERK_JS_VERSION</code> constant removed", "<code>DOMAIN</code> constant removed", "<code>IS_SATELLITE</code> constant removed", "<code>PROXY_URL</code> constant removed", "<code>PUBLISHABLE_KEY</code> constant removed", "<code>SECRET_KEY</code> constant removed", "<code>SIGN_IN_URL</code> constant removed", "<code>SIGN_UP_URL</code> constant removed", "<code>@clerk/nextjs/api</code> import removed", "<code>MultiSessionAppSupport</code> import moved under <code>/internal</code>", "<code>NEXT_PUBLIC_CLERK_JS</code> should be <code>NEXT_PUBLIC_CLERK_JS_URL</code>"]}>
|
|
602
|
+
<AccordionPanel>
|
|
603
|
+
If you are updating a user's password via the [`User.update` method](https://clerk.com/docs/references/javascript/user/user#update), it must be changed to [`User.updatePassword`](https://clerk.com/docs/references/javascript/user/password-management#update-password) instead. This method will require the current password as well as the desired new password. We made this update to improve the security of password changes. Example below:
|
|
604
|
+
|
|
605
|
+
```diff
|
|
606
|
+
- user.update({ password: 'foo' });
|
|
607
|
+
|
|
608
|
+
+ user.updatePassword({
|
|
609
|
+
+ currentPassword: 'bar',
|
|
610
|
+
+ newPassword: 'foo',
|
|
611
|
+
+ signOutOfOtherSessions: true,
|
|
612
|
+
+ });
|
|
613
|
+
```
|
|
614
|
+
</AccordionPanel>
|
|
615
|
+
<AccordionPanel>
|
|
616
|
+
The `CLERK_API_KEY` environment variable was renamed to `CLERK_SECRET_KEY`. You can visit your [Clerk dashboard](https://dashboard.clerk.com/last-active?path=api-keys) to copy/paste the new keys after choosing your framework. Make sure to update this in all environments (e.g. dev, staging, production).
|
|
617
|
+
</AccordionPanel>
|
|
618
|
+
<AccordionPanel>
|
|
619
|
+
The `CLERK_FRONTEND_API` environment variable was renamed to `CLERK_PUBLISHABLE_KEY`. You can visit your [Clerk dashboard](https://dashboard.clerk.com/last-active?path=api-keys) to copy/paste the new keys after choosing your framework. Make sure to update this in all environments (e.g. dev, staging, production). **Note:** The values are different, so this is not just a key replacement. [More information](/docs/deployments/overview#api-keys-and-environment-variables).
|
|
620
|
+
</AccordionPanel>
|
|
621
|
+
<AccordionPanel>
|
|
622
|
+
If you are using `CLERK_JS_VERSION` as an environment variable, it should be changed to `NEXT_PUBLIC_CLERK_JS_VERSION` instead.
|
|
623
|
+
|
|
624
|
+
This change brings our SDK up to date with the latest standards for next.js - that public environment variables should have the `NEXT_PUBLIC_` prefix. This env variable is not private, so it should get the public prefix.
|
|
625
|
+
</AccordionPanel>
|
|
626
|
+
<AccordionPanel>
|
|
627
|
+
The `apiKey` argument passed to `authMiddleware` must be changed to `secretKey`.
|
|
628
|
+
|
|
629
|
+
```diff
|
|
630
|
+
import { authMiddleware } from '@clerk/nextjs';
|
|
631
|
+
|
|
632
|
+
- authMiddleware({ apiKey: '...' });
|
|
633
|
+
+ authMiddleware({ secretKey: '...' });
|
|
634
|
+
```
|
|
635
|
+
</AccordionPanel>
|
|
636
|
+
<AccordionPanel>
|
|
637
|
+
The `frontendApi` argument passed to `authMiddleware` must be changed to `publishableKey`
|
|
638
|
+
|
|
639
|
+
```diff
|
|
640
|
+
import { authMiddleware } from "@clerk/nextjs/server"
|
|
641
|
+
|
|
642
|
+
- authMiddleware({ frontendApi: '...' })
|
|
643
|
+
+ authMiddleware({ publishableKey: '...' })
|
|
644
|
+
```
|
|
645
|
+
</AccordionPanel>
|
|
646
|
+
<AccordionPanel>
|
|
647
|
+
The `apiKey` argument passed to `createClerkClient` must be changed to `secretKey`.
|
|
648
|
+
|
|
649
|
+
```diff
|
|
650
|
+
import { createClerkClient } from '@clerk/nextjs/server';
|
|
651
|
+
|
|
652
|
+
- createClerkClient({ apiKey: '...' });
|
|
653
|
+
+ createClerkClient({ secretKey: '...' });
|
|
654
|
+
```
|
|
655
|
+
</AccordionPanel>
|
|
656
|
+
<AccordionPanel>
|
|
657
|
+
The `frontendApi` argument passed to `createClerkClient` must be changed to `publishableKey`. Note that the values of the two keys are different, so both keys and values need to be changed. You can find your application's publishable key in the Clerk dashboard.
|
|
658
|
+
|
|
659
|
+
```diff
|
|
660
|
+
import { createClerkClient } from '@clerk/nextjs/server';
|
|
661
|
+
|
|
662
|
+
- createClerkClient({ frontendApi: '...' });
|
|
663
|
+
+ createClerkClient({ publishableKey: '...' });
|
|
664
|
+
```
|
|
665
|
+
</AccordionPanel>
|
|
666
|
+
<AccordionPanel>
|
|
667
|
+
The `apiKey` argument passed to `getAuth` must be changed to `secretKey`.
|
|
668
|
+
|
|
669
|
+
```diff
|
|
670
|
+
- getAuth({ apiKey: '...' })
|
|
671
|
+
+ getAuth({ secretKey: '...' })
|
|
672
|
+
```
|
|
673
|
+
</AccordionPanel>
|
|
674
|
+
<AccordionPanel>
|
|
675
|
+
The `frontendApi` prop passed to `<ClerkProvider>` was renamed to `publishableKey`. **Note:** The values are different, so this is not just a key replacement. You can visit your [Clerk dashboard](https://dashboard.clerk.com/last-active?path=api-keys) to copy/paste the new keys after choosing your framework. Make sure to update this in all environments (e.g. dev, staging, production). [More information](/docs/deployments/overview#api-keys-and-environment-variables).
|
|
676
|
+
</AccordionPanel>
|
|
677
|
+
<AccordionPanel>
|
|
678
|
+
If you are using the `@clerk/nextjs/app-beta` import anywhere, it should use `@clerk/nextjs` instead. The `app-beta` import has been removed as our approuter support is stable, if there are any places you’re using it you can remove.
|
|
679
|
+
|
|
680
|
+
Make this change carefully as some behavior may have changed between our beta and stable releases. You can refer to [our documentation](https://clerk.com/docs/quickstarts/nextjs) and/or [approuter example](https://github.com/clerk/clerk-nextjs-app-quickstart) for up-to-date usage.
|
|
681
|
+
|
|
682
|
+
The `@clerk/nextjs` import will work with both App Router and Pages Router.
|
|
683
|
+
</AccordionPanel>
|
|
684
|
+
<AccordionPanel>
|
|
685
|
+
If you are importing from `@clerk/nextjs/ssr`, you can use `@clerk/nextjs` instead. Our top-level import supports SSR functionality by default now, so the subpath on the import is no longer needed. This import can be directly replaced without any other considerations.
|
|
686
|
+
</AccordionPanel>
|
|
687
|
+
<AccordionPanel>
|
|
688
|
+
This deprecated import has been replaced by `@clerk/nextjs`. Usage should now look as such: `import { authMiddleware } from @clerk/nextjs`. There may be changes in functionality between the two exports depending on how old the version used is, so upgrade with caution.
|
|
689
|
+
</AccordionPanel>
|
|
690
|
+
<AccordionPanel>
|
|
691
|
+
This deprecated import has been replaced by `@clerk/nextjs`. Usage should now look as such: `import { authMiddleware } from @clerk/nextjs`. There may be changes in functionality between the two exports depending on how old the version used is, so upgrade with caution.
|
|
692
|
+
</AccordionPanel>
|
|
693
|
+
<AccordionPanel>
|
|
694
|
+
This deprecated constant has been removed as an export from `@clerk/nextjs`. Instead, set and use the `CLERK_API_URL` environment variable.
|
|
695
|
+
</AccordionPanel>
|
|
696
|
+
<AccordionPanel>
|
|
697
|
+
This deprecated constant has been removed as an export from `@clerk/nextjs`. Instead, set and use the `CLERK_API_VERSION` environment variable.
|
|
698
|
+
</AccordionPanel>
|
|
699
|
+
<AccordionPanel>
|
|
700
|
+
This deprecated constant has been removed as an export from `@clerk/nextjs`. Instead, set and use the `NEXT_PUBLIC_CLERK_JS` environment variable.
|
|
701
|
+
</AccordionPanel>
|
|
702
|
+
<AccordionPanel>
|
|
703
|
+
This deprecated constant has been removed as an export from `@clerk/nextjs`. Instead, set and use the `NEXT_PUBLIC_CLERK_JS_VERSION` environment variable.
|
|
704
|
+
</AccordionPanel>
|
|
705
|
+
<AccordionPanel>
|
|
706
|
+
This deprecated constant has been removed as an export from `@clerk/nextjs`. Instead, set and use the `NEXT_PUBLIC_CLERK_DOMAIN` environment variable.
|
|
707
|
+
</AccordionPanel>
|
|
708
|
+
<AccordionPanel>
|
|
709
|
+
This deprecated constant has been removed as an export from `@clerk/nextjs`. Instead, set and use the `NEXT_PUBLIC_CLERK_IS_SATELLITE` environment variable.
|
|
710
|
+
</AccordionPanel>
|
|
711
|
+
<AccordionPanel>
|
|
712
|
+
This deprecated constant has been removed as an export from `@clerk/nextjs`. Instead, set and use the `NEXT_PUBLIC_CLERK_PROXY_URL` environment variable.
|
|
713
|
+
</AccordionPanel>
|
|
714
|
+
<AccordionPanel>
|
|
715
|
+
This deprecated constant has been removed as an export from `@clerk/nextjs`. Instead, set and use the `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` environment variable.
|
|
716
|
+
</AccordionPanel>
|
|
717
|
+
<AccordionPanel>
|
|
718
|
+
This deprecated constant has been removed as an export from `@clerk/nextjs`. Instead, set and use the `CLERK_SECRET_KEY` environment variable.
|
|
719
|
+
</AccordionPanel>
|
|
720
|
+
<AccordionPanel>
|
|
721
|
+
This deprecated constant has been removed as an export from `@clerk/nextjs`. Instead, set and use the `NEXT_PUBLIC_CLERK_SIGN_IN_URL` environment variable.
|
|
722
|
+
</AccordionPanel>
|
|
723
|
+
<AccordionPanel>
|
|
724
|
+
This deprecated constant has been removed as an export from `@clerk/nextjs`. Instead, set and use the `NEXT_PUBLIC_CLERK_SIGN_UP_URL` environment variable.
|
|
725
|
+
</AccordionPanel>
|
|
726
|
+
<AccordionPanel>
|
|
727
|
+
The import subpath `@clerk/nextjs/api` has been removed. This includes the following imports:
|
|
728
|
+
|
|
729
|
+
```js
|
|
730
|
+
// These have been removed
|
|
731
|
+
import {
|
|
732
|
+
ClerkMiddleware,
|
|
733
|
+
ClerkMiddlewareOptions,
|
|
734
|
+
LooseAuthProp,
|
|
735
|
+
RequireAuthProp,
|
|
736
|
+
StrictAuthProp,
|
|
737
|
+
WithAuthProp,
|
|
738
|
+
} from '@clerk/nextjs/api';
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
If you still need to use any of these functions, they can be instead imported from `@clerk/clerk-sdk-node`.
|
|
742
|
+
</AccordionPanel>
|
|
743
|
+
<AccordionPanel>
|
|
744
|
+
The `MultiSessionAppSupport` import path has changed from `@clerk/nextjs` to `@clerk/nextjs/internal`. You must update your import path in order for it to work correctly. Note that internal imports are not intended for usage and are outside the scope of semver. Example below of the fix that needs to be made:
|
|
745
|
+
|
|
746
|
+
```diff
|
|
747
|
+
- import { MultiSessionAppSupport } from "@clerk/nextjs"
|
|
748
|
+
+ import { MultiSessionAppSupport } from "@clerk/nextjs/internal"
|
|
749
|
+
```
|
|
750
|
+
</AccordionPanel>
|
|
751
|
+
<AccordionPanel>
|
|
752
|
+
If you are using `NEXT_PUBLIC_CLERK_JS` as an environment variable, it should be changed to `NEXT_PUBLIC_CLERK_JS_URL` instead. This variable was renamed for consistency across public APIs. Make sure to also check your production host configuration when changing environment variable values.
|
|
753
|
+
</AccordionPanel>
|
|
754
|
+
</Accordion>
|
|
755
|
+
|
|
756
|
+
#### Other Breaking Changes
|
|
757
|
+
|
|
758
|
+
<Accordion titles={["<code>Organization.getRoles</code> arguments changed", "<code>Organization.getMemberships</code> arguments changed", "<code>Organization.getDomains</code> arguments changed", "<code>Organization.getInvitations</code> arguments changed", "<code>Organization.getMembershipRequests</code> arguments changed", "<code>User.getOrganizationInvitations</code> arguments changed", "<code>User.getOrganizationSuggestions</code> arguments changed", "<code>User.getOrganizationMemberships</code> arguments changed", "<code>Users.getOrganizationInvitationList</code> return signature changed", "<code>Organizations.getOrganizationInvitationList</code> return type changed", "<code>User.getOrganizationMembershipList</code> return type changed", "<code>Users.getOrganizationList</code> return signature changed", "<code>Organization.getOrganizationList</code> return type changed", "<code>API_URL</code> value has changed", "<code>isMagicLinkError</code> -> <code>isEmailLinkError</code>", "<code>useMagicLink</code> -> <code>useEmailLink</code>", "<code>MagicLinkErrorCode</code> -> <code>EmailLinkErrorCode</code>", "<code>setSession</code> -> <code>setActive</code>", "<code>isMetamaskError</code> import moved under <code>/errors</code>", "<code>WithSession</code> component removed", "<code>WithClerk</code> component removed", "<code>WithUser</code> component removed", "<code>withClerk</code> function removed", "<code>withSession</code> function removed", "<code>withUser</code> function removed", "Replace <code>signOutCallback</code> prop on <code>SignOutButton</code> with <code>redirectUrl</code>"]}>
|
|
759
|
+
<AccordionPanel>
|
|
760
|
+
There have been a couple changes to the pagination arguments that can be passed into this function - `limit` has been renamed to `pageSize`, and `offset` has been renamed to `initialPage`. This will help to make it more clear and simple to reason about pagination control. Example of how changes might look below:
|
|
761
|
+
|
|
762
|
+
```diff
|
|
763
|
+
const { data } = await organization.getRoles({
|
|
764
|
+
- limit: 10,
|
|
765
|
+
+ pageSize: 10,
|
|
766
|
+
- offset: 10,
|
|
767
|
+
+ initialPage: 2,
|
|
768
|
+
})
|
|
769
|
+
```
|
|
770
|
+
</AccordionPanel>
|
|
771
|
+
<AccordionPanel>
|
|
772
|
+
There have been a couple changes to the pagination arguments that can be passed into this function - `limit` has been renamed to `pageSize`, and `offset` has been renamed to `initialPage`. This will help to make it more clear and simple to reason about pagination control. Example of how changes might look below:
|
|
773
|
+
|
|
774
|
+
```diff
|
|
775
|
+
const { data } = await organization.getMemberships({
|
|
776
|
+
- limit: 10,
|
|
777
|
+
+ pageSize: 10,
|
|
778
|
+
- offset: 10,
|
|
779
|
+
+ initialPage: 2,
|
|
780
|
+
})
|
|
781
|
+
```
|
|
782
|
+
</AccordionPanel>
|
|
783
|
+
<AccordionPanel>
|
|
784
|
+
There have been a couple changes to the pagination arguments that can be passed into this function - `limit` has been renamed to `pageSize`, and `offset` has been renamed to `initialPage`. This will help to make it more clear and simple to reason about pagination control. Example of how changes might look below:
|
|
785
|
+
|
|
786
|
+
```diff
|
|
787
|
+
const { data } = await organization.getDomains({
|
|
788
|
+
- limit: 10,
|
|
789
|
+
+ pageSize: 10,
|
|
790
|
+
- offset: 10,
|
|
791
|
+
+ initialPage: 2,
|
|
792
|
+
})
|
|
793
|
+
```
|
|
794
|
+
</AccordionPanel>
|
|
795
|
+
<AccordionPanel>
|
|
796
|
+
There have been a couple changes to the pagination arguments that can be passed into this function - `limit` has been renamed to `pageSize`, and `offset` has been renamed to `initialPage`. This will help to make it more clear and simple to reason about pagination control. Example of how changes might look below:
|
|
797
|
+
|
|
798
|
+
```diff
|
|
799
|
+
const { data } = await organization.getInvitations({
|
|
800
|
+
- limit: 10,
|
|
801
|
+
+ pageSize: 10,
|
|
802
|
+
- offset: 10,
|
|
803
|
+
+ initialPage: 2,
|
|
804
|
+
})
|
|
805
|
+
```
|
|
806
|
+
</AccordionPanel>
|
|
807
|
+
<AccordionPanel>
|
|
808
|
+
There have been a couple changes to the pagination arguments that can be passed into this function - `limit` has been renamed to `pageSize`, and `offset` has been renamed to `initialPage`. This will help to make it more clear and simple to reason about pagination control. Example of how changes might look below:
|
|
809
|
+
|
|
810
|
+
```diff
|
|
811
|
+
const { data } = await organization.getMembershipRequests({
|
|
812
|
+
- limit: 10,
|
|
813
|
+
+ pageSize: 10,
|
|
814
|
+
- offset: 10,
|
|
815
|
+
+ initialPage: 2,
|
|
816
|
+
})
|
|
817
|
+
```
|
|
818
|
+
</AccordionPanel>
|
|
819
|
+
<AccordionPanel>
|
|
820
|
+
There have been a couple changes to the pagination arguments that can be passed into this function - `limit` has been renamed to `pageSize`, and `offset` has been renamed to `initialPage`. This will help to make it more clear and simple to reason about pagination control. Example of how changes might look below:
|
|
821
|
+
|
|
822
|
+
```diff
|
|
823
|
+
const { data } = await user.getOrganizationInvitations({
|
|
824
|
+
- limit: 10,
|
|
825
|
+
+ pageSize: 10,
|
|
826
|
+
- offset: 10,
|
|
827
|
+
+ initialPage: 2,
|
|
828
|
+
})
|
|
829
|
+
```
|
|
830
|
+
</AccordionPanel>
|
|
831
|
+
<AccordionPanel>
|
|
832
|
+
There have been a couple changes to the pagination arguments that can be passed into this function - `limit` has been renamed to `pageSize`, and `offset` has been renamed to `initialPage`. This will help to make it more clear and simple to reason about pagination control. Example of how changes might look below:
|
|
833
|
+
|
|
834
|
+
```diff
|
|
835
|
+
const { data } = await user.getOrganizationSuggestions({
|
|
836
|
+
- limit: 10,
|
|
837
|
+
+ pageSize: 10,
|
|
838
|
+
- offset: 10,
|
|
839
|
+
+ initialPage: 2,
|
|
840
|
+
})
|
|
841
|
+
```
|
|
842
|
+
</AccordionPanel>
|
|
843
|
+
<AccordionPanel>
|
|
844
|
+
There have been a couple changes to the pagination arguments that can be passed into this function - `limit` has been renamed to `pageSize`, and `offset` has been renamed to `initialPage`. This will help to make it more clear and simple to reason about pagination control. Example of how changes might look below:
|
|
845
|
+
|
|
846
|
+
```diff
|
|
847
|
+
const { data } = await user.getOrganizationMemberships({
|
|
848
|
+
- limit: 10,
|
|
849
|
+
+ pageSize: 10,
|
|
850
|
+
- offset: 10,
|
|
851
|
+
+ initialPage: 2,
|
|
852
|
+
})
|
|
853
|
+
```
|
|
854
|
+
</AccordionPanel>
|
|
855
|
+
<AccordionPanel>
|
|
856
|
+
The response payload of `Users.getOrganizationInvitationList` was changed as part of the v5 release. Rather than directly returning ` data`, the return signature is now `{ data, totalCount }`. Since backend API responses are paginated, the `totalCount` property is helpful in determining the total number of items in the response easily, and this change in the backend SDK aligns the response shape with what the backend API returns directly.
|
|
857
|
+
|
|
858
|
+
Here's an example of how the response shape would change with this modification:
|
|
859
|
+
|
|
860
|
+
```diff
|
|
861
|
+
- const data = await clerkClient.users.getOrganizationInvitationList()
|
|
862
|
+
+ const { data, totalCount } = await clerkClient.users.getOrganizationInvitationList()
|
|
863
|
+
```
|
|
864
|
+
</AccordionPanel>
|
|
865
|
+
<AccordionPanel>
|
|
866
|
+
The return type for this function was previously `[Items]` but has now been updated to `{ data: [Items], totalCount: number }`. Since Clerk's API responses are paginated, the `totalCount` property is helpful in determining the total number of items in the response easily. A before/after code example can be seen below:
|
|
867
|
+
|
|
868
|
+
```diff
|
|
869
|
+
const data = await clerkClient.organizations.getOrganizationInvitationList({
|
|
870
|
+
organizationId: "...",
|
|
871
|
+
})
|
|
872
|
+
|
|
873
|
+
- data.forEach(() => {})
|
|
874
|
+
+ data.data.forEach(() => {})
|
|
875
|
+
```
|
|
876
|
+
</AccordionPanel>
|
|
877
|
+
<AccordionPanel>
|
|
878
|
+
The return type for this function was previously `[Items]` but has now been updated to `{ data: [Items], totalCount: number }`. Since Clerk's API responses are paginated, the `totalCount` property is helpful in determining the total number of items in the response easily. A before/after code example can be seen below:
|
|
879
|
+
|
|
880
|
+
```diff
|
|
881
|
+
const { user } = useUser()
|
|
882
|
+
const membershipList = user.getOrganizationMembershipList()
|
|
883
|
+
|
|
884
|
+
- membershipList.forEach(() => {})
|
|
885
|
+
+ membershipList.data.forEach(() => {})
|
|
886
|
+
```
|
|
887
|
+
</AccordionPanel>
|
|
888
|
+
<AccordionPanel>
|
|
889
|
+
The response payload of `Users.getOrganizationList` was changed as part of the v5 release. Rather than directly returning ` data`, the return signature is now `{ data, totalCount }`. Since backend API responses are paginated, the `totalCount` property is helpful in determining the total number of items in the response easily, and this change in the backend SDK aligns the response shape with what the backend API returns directly.
|
|
890
|
+
|
|
891
|
+
Here's an example of how the response shape would change with this modification:
|
|
892
|
+
|
|
893
|
+
```diff
|
|
894
|
+
- const data = await clerkClient.users.getOrganizationList()
|
|
895
|
+
+ const { data, totalCount } = await clerkClient.users.getOrganizationList()
|
|
896
|
+
```
|
|
897
|
+
</AccordionPanel>
|
|
898
|
+
<AccordionPanel>
|
|
899
|
+
The return type for this function was previously `[Items]` but has now been updated to `{ data: [Items], totalCount: number }`. Since Clerk's API responses are paginated, the `totalCount` property is helpful in determining the total number of items in the response easily. A before/after code example can be seen below:
|
|
900
|
+
|
|
901
|
+
```diff
|
|
902
|
+
const { organization } = useOrganization()
|
|
903
|
+
const orgList = organization.getOrganizationList()
|
|
904
|
+
|
|
905
|
+
- orgList.forEach(() => {})
|
|
906
|
+
+ orgList.data.forEach(() => {})
|
|
907
|
+
```
|
|
908
|
+
</AccordionPanel>
|
|
909
|
+
<AccordionPanel>
|
|
910
|
+
The value of this export has changed from `https://api.clerk.dev` to `https://api.clerk.com`. If you were relying on the text content of this value not changing, you may need to make adjustments.
|
|
911
|
+
</AccordionPanel>
|
|
912
|
+
<AccordionPanel>
|
|
913
|
+
Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects the functionality.
|
|
914
|
+
</AccordionPanel>
|
|
915
|
+
<AccordionPanel>
|
|
916
|
+
Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects functionality.
|
|
917
|
+
</AccordionPanel>
|
|
918
|
+
<AccordionPanel>
|
|
919
|
+
Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects the functionality.
|
|
920
|
+
</AccordionPanel>
|
|
921
|
+
<AccordionPanel>
|
|
922
|
+
`setSession` should be replaced with `setActive`. The format of the parameters has changed slightly - `setActive` takes an object where `setSession` took params directly. The `setActive` function also can accept an `organization` param that is used to set the currently active organization. The return signature did not change. Read the [API documentation](/docs/references/javascript/clerk/session-methods#set-active) for more detail. This function should be expected to be returned from one of the following Clerk hooks: `useSessionList`, `useSignUp`, or `useSignIn`. Some migration examples:
|
|
923
|
+
|
|
924
|
+
```diff
|
|
925
|
+
- await setSession('sessionID', () => void)
|
|
926
|
+
+ await setActive({ session: 'sessionID', beforeEmit: () => void })
|
|
927
|
+
|
|
928
|
+
- await setSession(sessionObj)
|
|
929
|
+
+ await setActive({ session: sessionObj })
|
|
930
|
+
|
|
931
|
+
- await setSession(sessionObj, () => void)
|
|
932
|
+
+ await setActive({ session: sessionObj, beforeEmit: () => void })
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
`setActive` also supports setting an active organization:
|
|
936
|
+
|
|
937
|
+
```js
|
|
938
|
+
await setActive({
|
|
939
|
+
session: 'sessionID',
|
|
940
|
+
organization: 'orgID',
|
|
941
|
+
beforeEmit: () => void
|
|
942
|
+
})
|
|
943
|
+
|
|
944
|
+
await setActive({
|
|
945
|
+
session: sessionObj,
|
|
946
|
+
organization: orgObj,
|
|
947
|
+
beforeEmit: () => void
|
|
948
|
+
})
|
|
949
|
+
```
|
|
950
|
+
</AccordionPanel>
|
|
951
|
+
<AccordionPanel>
|
|
952
|
+
The `isMetamaskError` import path has changed from `@clerk/react` to `@clerk/react/errors`. You must update your import path in order for it to work correctly. Example below of the fix that needs to be made:
|
|
953
|
+
|
|
954
|
+
```diff
|
|
955
|
+
- import { isMetamaskError } from "@clerk/react"
|
|
956
|
+
+ import { isMetamaskError } from "@clerk/react/errors"
|
|
957
|
+
```
|
|
958
|
+
</AccordionPanel>
|
|
959
|
+
<AccordionPanel>
|
|
960
|
+
The `WithSession` higher order component has been removed. If you would still like to use this function in the way its implemented, it can be created quickly using Clerk's [custom hooks](https://clerk.com/docs/references/react/overview). An example of how to do so is below:
|
|
961
|
+
|
|
962
|
+
```js
|
|
963
|
+
export const WithSession = ({ children }) => {
|
|
964
|
+
const session = useSession();
|
|
965
|
+
if (typeof children !== 'function') throw new Error();
|
|
966
|
+
|
|
967
|
+
return {children(session)};
|
|
968
|
+
};
|
|
969
|
+
```
|
|
970
|
+
</AccordionPanel>
|
|
971
|
+
<AccordionPanel>
|
|
972
|
+
The `WithClerk` higher order component has been removed. If you would still like to use this function in the way its implemented, it can be created quickly using Clerk's [custom hooks](https://clerk.com/docs/references/react/overview). An example of how to do so is below:
|
|
973
|
+
|
|
974
|
+
```js
|
|
975
|
+
export const WithClerk = ({ children }) => {
|
|
976
|
+
const clerk = useClerk();
|
|
977
|
+
if (typeof children !== 'function') throw new Error();
|
|
978
|
+
|
|
979
|
+
return {children(clerk)};
|
|
980
|
+
};
|
|
981
|
+
```
|
|
982
|
+
</AccordionPanel>
|
|
983
|
+
<AccordionPanel>
|
|
984
|
+
The `WithUser` higher order component has been removed. If you would still like to use this function in the way its implemented, it can be created quickly using Clerk's [custom hooks](https://clerk.com/docs/references/react/overview). An example of how to do so is below:
|
|
985
|
+
|
|
986
|
+
```js
|
|
987
|
+
export const WithUser = ({ children }) => {
|
|
988
|
+
const user = useUser();
|
|
989
|
+
if (typeof children !== 'function') throw new Error();
|
|
990
|
+
|
|
991
|
+
return {children(user)};
|
|
992
|
+
};
|
|
993
|
+
```
|
|
994
|
+
</AccordionPanel>
|
|
995
|
+
<AccordionPanel>
|
|
996
|
+
The `withClerk` higher order function has been removed. If you would still like to use this function in the way its implemented, it can be created quickly using Clerk's [custom hooks](https://clerk.com/docs/references/react/overview). An example of how to do so is below:
|
|
997
|
+
|
|
998
|
+
```js
|
|
999
|
+
function withClerk(Component, displayName) {
|
|
1000
|
+
displayName = displayName || Component.displayName || Component.name || 'Component';
|
|
1001
|
+
Component.displayName = displayName;
|
|
1002
|
+
const HOC = props => {
|
|
1003
|
+
const clerk = useIsomorphicClerkContext();
|
|
1004
|
+
|
|
1005
|
+
if (!clerk.loaded) return null;
|
|
1006
|
+
|
|
1007
|
+
return (
|
|
1008
|
+
<Component
|
|
1009
|
+
{...props}
|
|
1010
|
+
clerk={clerk}
|
|
1011
|
+
/>
|
|
1012
|
+
);
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
HOC.displayName = `withClerk(${displayName})`;
|
|
1016
|
+
return HOC;
|
|
1017
|
+
}
|
|
1018
|
+
```
|
|
1019
|
+
</AccordionPanel>
|
|
1020
|
+
<AccordionPanel>
|
|
1021
|
+
The `withSession` higher order function has been removed. If you would still like to use this function in the way its implemented, it can be created quickly using Clerk's [custom hooks](https://clerk.com/docs/references/react/overview). An example of how to do so is below:
|
|
1022
|
+
|
|
1023
|
+
```js
|
|
1024
|
+
function withSession(Component, displayName) {
|
|
1025
|
+
displayName = displayName || Component.displayName || Component.name || 'Component';
|
|
1026
|
+
Component.displayName = displayName;
|
|
1027
|
+
const HOC = props => {
|
|
1028
|
+
const session = useSessionContext();
|
|
1029
|
+
|
|
1030
|
+
if (!session) return null;
|
|
1031
|
+
|
|
1032
|
+
return (
|
|
1033
|
+
<Component
|
|
1034
|
+
{...props}
|
|
1035
|
+
session={session}
|
|
1036
|
+
/>
|
|
1037
|
+
);
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
HOC.displayName = `withSession(${displayName})`;
|
|
1041
|
+
return HOC;
|
|
1042
|
+
}
|
|
1043
|
+
```
|
|
1044
|
+
</AccordionPanel>
|
|
1045
|
+
<AccordionPanel>
|
|
1046
|
+
The `withUser` higher order function has been removed. If you would still like to use this function in the way its implemented, it can be created quickly using Clerk's [custom hooks](https://clerk.com/docs/references/react/overview). An example of how to do so is below:
|
|
1047
|
+
|
|
1048
|
+
```js
|
|
1049
|
+
function withUser(Component, displayName) {
|
|
1050
|
+
displayName = displayName || Component.displayName || Component.name || 'Component';
|
|
1051
|
+
Component.displayName = displayName;
|
|
1052
|
+
const HOC = props => {
|
|
1053
|
+
const clerk = useUserContext();
|
|
1054
|
+
|
|
1055
|
+
if (!user) return null;
|
|
1056
|
+
|
|
1057
|
+
return (
|
|
1058
|
+
<Component
|
|
1059
|
+
{...props}
|
|
1060
|
+
user={user}
|
|
1061
|
+
/>
|
|
1062
|
+
);
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
HOC.displayName = `withUser(${displayName})`;
|
|
1066
|
+
return HOC;
|
|
1067
|
+
}
|
|
1068
|
+
```
|
|
1069
|
+
</AccordionPanel>
|
|
1070
|
+
<AccordionPanel>
|
|
1071
|
+
The `signOutCallback` prop on the [`<SignOutButton />` component](https://clerk.com/docs/components/unstyled/sign-out-button) has been removed. Instead, you can use the `redirectUrl` prop. Example below:
|
|
1072
|
+
|
|
1073
|
+
```diff
|
|
1074
|
+
import { SignOutButton } from "@clerk/clerk-react";
|
|
1075
|
+
|
|
1076
|
+
export const Signout = () => {
|
|
1077
|
+
return (
|
|
1078
|
+
<SignOutButton
|
|
1079
|
+
- signOutCallback={() => { window.location.href = "/your-path" }}
|
|
1080
|
+
+ redirectUrl="/your-path"
|
|
1081
|
+
>
|
|
1082
|
+
<button>Sign Out</button>
|
|
1083
|
+
</SignOutButton>
|
|
1084
|
+
)
|
|
1085
|
+
}
|
|
1086
|
+
```
|
|
1087
|
+
</AccordionPanel>
|
|
1088
|
+
</Accordion>
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
|