javascript

Official Javascript repository for Clerk authentication

MIT License

Downloads
6.1M
Stars
1.1K
Committers
167
javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Patch Changes

  • 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

javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Major Changes

  • 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(...);
    

Patch Changes

    • 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]:

javascript - [email protected]

Published by clerk-cookie 9 months ago

Patch Changes

javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Patch Changes

javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Patch Changes

javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Patch Changes

javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Major Changes

  • 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(...);
    

Patch Changes

  • Update @clerk/nextjs error messages to refer to clerkMiddleware() and deprecated authMiddleware() and fix a typo in cannotRenderSignUpComponentWhenSessionExists error message. (#2589) by @dimkl
javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Patch Changes

javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Patch Changes

  • Update README for v5 (#2577) by @LekoArts

  • 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]:

javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Patch Changes

javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Patch Changes

javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Patch Changes

javascript - [email protected]

Published by clerk-cookie 9 months ago

Patch Changes

javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Patch Changes

javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Patch Changes

javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Patch Changes

  • 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.

  • Update README for v5 (#2577) by @LekoArts

javascript - @clerk/[email protected]

Published by clerk-cookie 9 months ago

Patch Changes

javascript - @clerk/[email protected]

Published by clerk-cookie 10 months ago

Patch Changes

javascript - @clerk/[email protected]

Published by clerk-cookie 10 months ago

Patch Changes

javascript - @clerk/[email protected]

Published by clerk-cookie 10 months ago

Patch Changes

  • Ensure the token returned from getToken() and the token in the session cookie remain in sync. (#2585) by @BRKalow