Official Javascript repository for Clerk authentication
MIT License
Published by clerk-cookie 9 months ago
Update @clerk/nextjs
error messages to refer to clerkMiddleware()
and deprecated authMiddleware()
and fix a typo in cannotRenderSignUpComponentWhenSessionExists
error message. (#2589) by @dimkl
Throw error for unsupported method OrganizationMembership.reload
(#2604) by @panteliselef
Use pattern for email input fields. (#2575) by @panteliselef
Take account custom pages when redirecting inside OrganizationProfile. (#2600) by @panteliselef
Published by clerk-cookie 9 months ago
Replace return the value of the following jwt helpers to match the format of backend API client return values (for consistency). (#2596) by @dimkl
import { signJwt } from '@clerk/backend/jwt';
- const { data, error } = await signJwt(...);
+ const { data, errors: [error] = [] } = await signJwt(...);
import { verifyJwt } from '@clerk/backend/jwt';
- const { data, error } = await verifyJwt(...);
+ const { data, errors: [error] = [] } = await verifyJwt(...);
import { hasValidSignature } from '@clerk/backend/jwt';
- const { data, error } = await hasValidSignature(...);
+ const { data, errors: [error] = [] } = await hasValidSignature(...);
import { decodeJwt } from '@clerk/backend/jwt';
- const { data, error } = await decodeJwt(...);
+ const { data, errors: [error] = [] } = await decodeJwt(...);
import { verifyToken } from '@clerk/backend';
- const { data, error } = await verifyToken(...);
+ const { data, errors: [error] = [] } = await verifyToken(...);
Export ClerkMiddlewareAuthObject, ClerkMiddlewareAuth and ClerkMiddlewareOptions types (#2611) by @nikosdouvlis
Introduce auth().redirectToSignIn()
that can be used in API routes and pages, eg
import { auth } from '@clerk/nextjs/server';
export const Layout = ({ children }) => {
const { userId } = auth();
if (!userId) {
return auth().redirectToSignIn();
}
return <>{children}</>;
};
Update @clerk/nextjs
error messages to refer to clerkMiddleware()
and deprecated authMiddleware()
and fix a typo in cannotRenderSignUpComponentWhenSessionExists
error message. (#2589) by @dimkl
Updated dependencies [3a2f13604
, 9e99eb727
, 6fffd3b54
]:
Published by clerk-cookie 9 months ago
3a2f13604
, 9e99eb727
, f0126a7ae
, 6fffd3b54
]:
Published by clerk-cookie 9 months ago
9e99eb727
, 491fba5ad
, 8b261add2
, 6fd303b99
]:
Published by clerk-cookie 9 months ago
3a2f13604
, 9e99eb727
, 6fffd3b54
]:
Published by clerk-cookie 9 months ago
9e99eb727
, 491fba5ad
, 8b261add2
, 6fd303b99
]:
Published by clerk-cookie 9 months ago
Drop user
/ organization
/ session
from auth object on signed-out state (current value was null
). Eg (#2598) by @dimkl
// Backend
import { createClerkClient } from '@clerk/backend';
const clerkClient = createClerkClient({...});
const requestState = clerkClient.authenticateRequest(request, {...});
- const { user, organization, session } = requestState.toAuth();
+ const { userId, organizationId, sessionId } = requestState.toAuth();
// Remix
import { getAuth } from '@clerk/remix/ssr.server';
- const { user, organization, session } = await getAuth(args);
+ const { userId, organizationId, sessionId } = await getAuth(args);
// or
rootAuthLoader(
args,
({ request }) => {
- const { user, organization, session } = request.auth;
+ const { userId, organizationId, sessionId } = request.auth;
// ...
},
{ loadUser: true },
);
// NextJS
import { getAuth } from '@clerk/nextjs/server';
- const { user, organization, session } = getAuth(args);
+ const { userId, organizationId, sessionId } = getAuth(req, opts);
// Gatsby
import { withServerAuth } from 'gatsby-plugin-clerk';
export const getServerData: GetServerData<any> = withServerAuth(
async props => {
- const { user, organization, session } = props;
+ const { userId, organizationId, sessionId } = props;
return { props: { data: '1', auth: props.auth, userId, organizationId, sessionId } };
},
{ loadUser: true },
);
Replace return the value of the following jwt helpers to match the format of backend API client return values (for consistency). (#2596) by @dimkl
import { signJwt } from '@clerk/backend/jwt';
- const { data, error } = await signJwt(...);
+ const { data, errors: [error] = [] } = await signJwt(...);
import { verifyJwt } from '@clerk/backend/jwt';
- const { data, error } = await verifyJwt(...);
+ const { data, errors: [error] = [] } = await verifyJwt(...);
import { hasValidSignature } from '@clerk/backend/jwt';
- const { data, error } = await hasValidSignature(...);
+ const { data, errors: [error] = [] } = await hasValidSignature(...);
import { decodeJwt } from '@clerk/backend/jwt';
- const { data, error } = await decodeJwt(...);
+ const { data, errors: [error] = [] } = await decodeJwt(...);
import { verifyToken } from '@clerk/backend';
- const { data, error } = await verifyToken(...);
+ const { data, errors: [error] = [] } = await verifyToken(...);
Published by clerk-cookie 9 months ago
Updated dependencies [935b0886e
, 6a769771c
]:
Published by clerk-cookie 9 months ago
Introduce createRouteMatcher
which is designed to generate and return a function that evaluates whether a given Request object matches a set of predefined routes. It provides flexibility in defining these routes through various patterns, including glob patterns, regular expressions, and custom functions. This composable helper can be used in combination with the clerkMiddleware
helper to easily protect specific routes, eg: (#2572) by @nikosdouvlis
import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server';
const isProtectedRoute = createRouteMatcher(['/dashboard(.*)']);
export default clerkMiddleware((auth, request) => {
if (isProtectedRoute(request)) {
auth().protect();
}
});
Fix partial prerendering error when using NextJS by correctly rethrowing partial prerendering (PPR) error. (#2518) by @juliuslipp
Updated dependencies [935b0886e
, 6a769771c
]:
Published by clerk-cookie 9 months ago
Updated dependencies [935b0886e
, 6a769771c
]:
Published by clerk-cookie 9 months ago
Hide backup codes when adding phone_code
mfa and instance setting is off. (#2583) by @panteliselef
Updated dependencies [34fe88f73
]:
Published by clerk-cookie 9 months ago
Published by clerk-cookie 9 months ago
Updated dependencies [935b0886e
, 6a769771c
]:
Published by clerk-cookie 9 months ago
935b0886e
, 6a769771c
]:
Published by clerk-cookie 9 months ago
434a96ebe
, 6a769771c
]:
Published by clerk-cookie 9 months ago
The emails
endpoint helper and the corresponding createEmail
method have been removed from the @clerk/backend
SDK and apiClint.emails.createEmail
will no longer be available. (#2548) by @Nikpolik
We will not be providing an alternative method for creating and sending emails directly from our JavaScript SDKs with this release. If you are currently using createEmail
and you wish to update to the latest SDK version, please reach out to our support team (https://clerk.com/support) so we can assist you.
Published by clerk-cookie 9 months ago
434a96ebe
, 6a769771c
]:
Published by clerk-cookie 10 months ago
2572dfcbf
]:
Published by clerk-cookie 10 months ago
2572dfcbf
]:
Published by clerk-cookie 10 months ago