Repository: clerk/javascript
Pull request #5507: chore(shared,vue,nextjs,astro,clerk-react): Update `useAuth` to handle pending session as signed-out
Author: login: LauraBeatris
Labels: name: nextjs
name: react
name: astro
name: vue
Created: 2025-04-02T09:53:34Z | Merged: 2025-04-03T21:31:53Z

## Description

Part of ORGS-621 

Allows to pass `treatPendingAsSignedOut` as an option to `useAuth` - refer to the following behavior when a session has a pending status:

```ts
// userId is undefined, since pending is treat as signed-out state (default behavior)
const { userId } = useAuth() 

// userId is defined, since pending is treat as signed-out state (opt-in behavior)
const { userId } = useAuth({ treatPendingAsSignedOut: true })
```

Globally changing the default: 
```tsx
<ClerkProvider treatPendingAsSignedOut={false} />
```

--- 

Example from Nuxt route middleware: 

```ts
const isProtectedRoute = createRouteMatcher(['/dashboard(.*)', '/forum(.*)'])

export default defineNuxtRouteMiddleware((to) => {
  const { userId } = useAuth()

  // If the user has a pending session, they aren't allowed to access
  // the protected route and are redirected to the sign-in page
  // If the sign-in page renders `SignIn`, then it'll redirect to `/tasks` internal route on component mount
  if (!userId.value && isProtectedRoute(to)) {
    return navigateTo('/sign-in')
  }
})
```

<!-- 
  Thanks for contributing to Clerk. Make sure to read the contributing guide at https://github.com/clerk/javascript/blob/main/docs/CONTRIBUTING.md before opening a PR!

  **Please create a feature request before starting work on any significant change.**

  Write a brief description of the changes introduced in this PR.
  Include screenshots/videos if they help convey the change.

  Also explain how one can test the change.
-->

<!-- Fixes #(issue number) -->

## Checklist

- [X] `pnpm test` runs as expected.
- [X] `pnpm build` runs as expected.
- [ ] (If applicable) [JSDoc comments](https://jsdoc.app/about-getting-started.html) have been added or updated for any package exports
- [ ] (If applicable) [Documentation](https://github.com/clerk/clerk-docs) has been updated

## Type of change

- [ ] 🐛 Bug fix
- [X] 🌟 New feature
- [ ] 🔨 Breaking change
- [ ] 📖 Refactoring / dependency upgrade / documentation
- [ ] other:



Diff:
diff --git a/.changeset/common-teams-do.md b/.changeset/common-teams-do.md
new file mode 100644
index 00000000000..67949c53954
--- /dev/null
+++ b/.changeset/common-teams-do.md
@@ -0,0 +1,5 @@
+---
+'@clerk/astro': minor
+---
+
+Update `useAuth` to handle pending sessions as signed-out by default, with opt-out via `useAuth({ treatPendingAsSignedOut: false })` or `clerk({ treatPendingAsSignedOut: false })`
diff --git a/.changeset/early-boats-help.md b/.changeset/early-boats-help.md
new file mode 100644
index 00000000000..c5ea805c0fd
--- /dev/null
+++ b/.changeset/early-boats-help.md
@@ -0,0 +1,5 @@
+---
+'@clerk/vue': minor
+---
+
+Update `useAuth` to handle pending sessions as signed-out by default, with opt-out via `useAuth({ treatPendingAsSignedOut: false })` or `app.use(clerkPlugin, { treatPendingAsSignedOut: false })`
diff --git a/.changeset/modern-paws-mate.md b/.changeset/modern-paws-mate.md
new file mode 100644
index 00000000000..75f08cd83ca
--- /dev/null
+++ b/.changeset/modern-paws-mate.md
@@ -0,0 +1,7 @@
+---
+'@clerk/nextjs': patch
+'@clerk/shared': patch
+'@clerk/clerk-react': patch
+---
+
+Update `useAuth` to handle pending sessions as signed-out by default, with opt-out via `useAuth({ treatPendingAsSignedOut: false })` or `<ClerkProvider treatPendingAsSignedOut={false} />`
diff --git a/packages/astro/src/env.d.ts b/packages/astro/src/env.d.ts
index 0d0c534341c..410177d713e 100644
--- a/packages/astro/src/env.d.ts
+++ b/packages/astro/src/env.d.ts
@@ -18,6 +18,7 @@ interface InternalEnv {
   readonly PUBLIC_CLERK_SIGN_UP_URL?: string;
   readonly PUBLIC_CLERK_TELEMETRY_DISABLED?: string;
   readonly PUBLIC_CLERK_TELEMETRY_DEBUG?: string;
+  readonly PUBLIC_CLERK_TREAT_PENDING_AS_SIGNED_OUT?: string;
 }
 
 interface ImportMeta {
diff --git a/packages/astro/src/integration/create-integration.ts b/packages/astro/src/integration/create-integration.ts
index 70c3b198d84..3a253411df3 100644
--- a/packages/astro/src/integration/create-integration.ts
+++ b/packages/astro/src/integration/create-integration.ts
@@ -19,7 +19,15 @@ type HotloadAstroClerkIntegrationParams = AstroClerkIntegrationParams & {
 
 function createIntegration<Params extends HotloadAstroClerkIntegrationParams>() {
   return (params?: Params): AstroIntegration => {
-    const { proxyUrl, isSatellite, domain, signInUrl, signUpUrl, enableEnvSchema = true } = params || {};
+    const {
+      proxyUrl,
+      isSatellite,
+      domain,
+      signInUrl,
+      signUpUrl,
+      enableEnvSchema = true,
+      treatPendingAsSignedOut,
+    } = params || {};
 
     // These are not provided when the "bundled" integration is used
     const clerkJSUrl = (params as any)?.clerkJSUrl as string | undefined;
@@ -57,6 +65,7 @@ function createIntegration<Params extends HotloadAstroClerkIntegrationParams>()
                 /**
                  * Convert the integration params to environment variable in order for it to be readable from the server
                  */
+                ...buildEnvVarFromOption(treatPendingAsSignedOut, 'PUBLIC_CLERK_TREAT_PENDING_AS_SIGNED_OUT'),
                 ...buildEnvVarFromOption(signInUrl, 'PUBLIC_CLERK_SIGN_IN_URL'),
                 ...buildEnvVarFromOption(signUpUrl, 'PUBLIC_CLERK_SIGN_UP_URL'),
                 ...buildEnvVarFromOption(isSatellite, 'PUBLIC_CLERK_IS_SATELLITE'),
diff --git a/packages/astro/src/react/hooks.ts b/packages/astro/src/react/hooks.ts
index 3c04dac4991..c3c49b4b249 100644
--- a/packages/astro/src/react/hooks.ts
+++ b/packages/astro/src/react/hooks.ts
@@ -1,22 +1,20 @@
+import { resolveAuthState } from '@clerk/shared/authorization';
 import type {
-  ActClaim,
   CheckAuthorizationWithCustomPermissions,
   Clerk,
   GetToken,
-  OrganizationCustomRoleKey,
+  PendingSessionOptions,
   SignOut,
+  UseAuthReturn,
 } from '@clerk/types';
 import type { Store, StoreValue } from 'nanostores';
 import { useCallback, useSyncExternalStore } from 'react';
 
 import { authAsyncStorage } from '#async-local-storage';
 
-import { $authStore } from '../stores/external';
+import { $authStore, $clerkStore } from '../stores/external';
 import { $clerk, $csrState } from '../stores/internal';
 
-type CheckAuthorizationSignedOut = undefined;
-type CheckAuthorizationWithoutOrgOrUser = (params?: Parameters<CheckAuthorizationWithCustomPermissions>[0]) => false;
-
 /**
  * @internal
  */
@@ -54,61 +52,7 @@ const createSignOut = () => {
   };
 };
 
-type UseAuthReturn =
-  | {
-      isLoaded: false;
-      isSignedIn: undefined;
-      userId: undefined;
-      sessionId: undefined;
-      actor: undefined;
-      orgId: undefined;
-      orgRole: undefined;
-      orgSlug: undefined;
-      has: CheckAuthorizationSignedOut;
-      signOut: SignOut;
-      getToken: GetToken;
-    }
-  | {
-      isLoaded: true;
-      isSignedIn: false;
-      userId: null;
-      sessionId: null;
-      actor: null;
-      orgId: null;
-      orgRole: null;
-      orgSlug: null;
-      has: CheckAuthorizationWithoutOrgOrUser;
-      signOut: SignOut;
-      getToken: GetToken;
-    }
-  | {
-      isLoaded: true;
-      isSignedIn: true;
-      userId: string;
-      sessionId: string;
-      actor: ActClaim | null;
-      orgId: null;
-      orgRole: null;
-      orgSlug: null;
-      has: CheckAuthorizationWithoutOrgOrUser;
-      signOut: SignOut;
-      getToken: GetToken;
-    }
-  | {
-      isLoaded: true;
-      isSignedIn: true;
-      userId: string;
-      sessionId: string;
-      actor: ActClaim | null;
-      orgId: string;
-      orgRole: OrganizationCustomRoleKey;
-      orgSlug: string | null;
-      has: CheckAuthorizationWithCustomPermissions;
-      signOut: SignOut;
-      getToken: GetToken;
-    };
-
-type UseAuth = () => UseAuthReturn;
+type UseAuth = (options?: PendingSessionOptions) => UseAuthReturn;
 
 /**
  * Returns the current auth state, the user and session ids and the `getToken`
@@ -138,12 +82,15 @@ type UseAuth = () => UseAuthReturn;
  *   return <div>...</div>
  * }
  */
-export const useAuth: UseAuth = () => {
-  const { sessionId, userId, actor, orgId, orgRole, orgSlug, orgPermissions } = useStore($authStore);
+export const useAuth: UseAuth = ({ treatPendingAsSignedOut } = {}) => {
+  const authContext = useStore($authStore);
+  const clerkContext = useStore($clerkStore);
 
   const getToken: GetToken = useCallback(createGetToken(), []);
   const signOut: SignOut = useCallback(createSignOut(), []);
 
+  const { userId, orgId, orgRole, orgPermissions } = authContext;
+
   const has = useCallback(
     (params: Parameters<CheckAuthorizationWithCustomPermissions>[0]) => {
       if (!params?.permission && !params?.role) {
@@ -169,71 +116,27 @@ export const useAuth: UseAuth = () => {
     [orgId, orgRole, userId, orgPermissions],
   );
 
-  if (sessionId === undefined && userId === undefined) {
-    return {
-      isLoaded: false,
-      isSignedIn: undefined,
-      sessionId,
-      userId,
-      actor: undefined,
-      orgId: undefined,
-      orgRole: undefined,
-      orgSlug: undefined,
-      has: undefined,
-      signOut,
+  const payload = resolveAuthState({
+    authObject: {
+      ...authContext,
       getToken,
-    };
-  }
-
-  if (sessionId === null && userId === null) {
-    return {
-      isLoaded: true,
-      isSignedIn: false,
-      sessionId,
-      userId,
-      actor: null,
-      orgId: null,
-      orgRole: null,
-      orgSlug: null,
-      has: () => false,
       signOut,
-      getToken,
-    };
-  }
-
-  if (!!sessionId && !!userId && !!orgId && !!orgRole) {
-    return {
-      isLoaded: true,
-      isSignedIn: true,
-      sessionId,
-      userId,
-      actor: actor || null,
-      orgId,
-      orgRole,
-      orgSlug: orgSlug || null,
       has,
-      signOut,
-      getToken,
-    };
-  }
+    },
+    options: {
+      treatPendingAsSignedOut:
+        // Fallback from option provided via SSR / CSR contexts
+        treatPendingAsSignedOut ??
+        clerkContext?.__internal_getOption?.('treatPendingAsSignedOut') ??
+        import.meta.env.PUBLIC_CLERK_TREAT_PENDING_AS_SIGNED_OUT,
+    },
+  });
 
-  if (!!sessionId && !!userId && !orgId) {
-    return {
-      isLoaded: true,
-      isSignedIn: true,
-      sessionId,
-      userId,
-      actor: actor || null,
-      orgId: null,
-      orgRole: null,
-      orgSlug: null,
-      has: () => false,
-      signOut,
-      getToken,
-    };
+  if (!payload) {
+    throw new Error('Invalid state. Feel free to submit a bug or reach out to support');
   }
 
-  throw new Error('Invalid state. Feel free to submit a bug or reach out to support');
+  return payload;
 };
 
 /**
diff --git a/packages/nextjs/src/client-boundary/PromisifiedAuthProvider.tsx b/packages/nextjs/src/client-boundary/PromisifiedAuthProvider.tsx
index c9e000a87da..733dfc8a917 100644
--- a/packages/nextjs/src/client-boundary/PromisifiedAuthProvider.tsx
+++ b/packages/nextjs/src/client-boundary/PromisifiedAuthProvider.tsx
@@ -54,7 +54,7 @@ export function PromisifiedAuthProvider({
  * }
  * ```
  */
-export function usePromisifiedAuth() {
+export function usePromisifiedAuth(options: Parameters<typeof useAuth>[0] = {}) {
   const isPagesRouter = useRouter();
   const valueFromContext = React.useContext(PromisifiedAuthContext);
 
@@ -64,16 +64,15 @@ export function usePromisifiedAuth() {
   }
 
   // At this point we should have a usable auth object
-
   if (typeof window === 'undefined') {
     // Pages router should always use useAuth as it is able to grab initial auth state from context during SSR.
     if (isPagesRouter) {
-      return useAuth();
+      return useAuth(options);
     }
 
     // We don't need to deal with Clerk being loaded here
-    return useDerivedAuth(resolvedData);
+    return useDerivedAuth({ ...resolvedData, ...options });
   } else {
-    return useAuth(resolvedData);
+    return useAuth({ ...resolvedData, ...options });
   }
 }
diff --git a/packages/react/src/hooks/__tests__/useAuth.test.tsx b/packages/react/src/hooks/__tests__/useAuth.test.tsx
index bab1bd2f23e..420c79fc9dd 100644
--- a/packages/react/src/hooks/__tests__/useAuth.test.tsx
+++ b/packages/react/src/hooks/__tests__/useAuth.test.tsx
@@ -101,6 +101,94 @@ describe('useDerivedAuth', () => {
     expect(current.has?.({ permission: 'test' })).toBe(false);
   });
 
+  it('returns signed out state when session has pending status by default', () => {
+    const authObject = {
+      sessionId: 'session123',
+      sessionStatus: 'pending',
+      userId: 'user123',
+      actor: 'actor123',
+      orgId: 'org123',
+      orgRole: 'admin',
+      orgSlug: 'my-org',
+      signOut: vi.fn(),
+      getToken: vi.fn(),
+    };
+
+    const {
+      result: { current },
+    } = renderHook(() => useDerivedAuth(authObject));
+
+    expect(current.isLoaded).toBe(true);
+    expect(current.isSignedIn).toBe(false);
+    expect(current.sessionId).toBeNull();
+    expect(current.userId).toBeNull();
+    expect(current.actor).toBeNull();
+    expect(current.orgId).toBeNull();
+    expect(current.orgRole).toBeNull();
+    expect(current.orgSlug).toBeNull();
+    expect(current.has).toBeInstanceOf(Function);
+    expect(current.has?.({ permission: 'test' })).toBe(false);
+  });
+
+  it('with `treatPendingAsSignedOut: true` option, returns signed out state when session has pending status', () => {
+    const authObject = {
+      sessionId: 'session123',
+      sessionStatus: 'pending',
+      userId: 'user123',
+      actor: 'actor123',
+      orgId: 'org123',
+      orgRole: 'admin',
+      orgSlug: 'my-org',
+      signOut: vi.fn(),
+      getToken: vi.fn(),
+    };
+
+    const {
+      result: { current },
+    } = renderHook(() => useDerivedAuth(authObject, { treatPendingAsSignedOut: true }));
+
+    expect(current.isLoaded).toBe(true);
+    expect(current.isSignedIn).toBe(false);
+    expect(current.sessionId).toBeNull();
+    expect(current.userId).toBeNull();
+    expect(current.actor).toBeNull();
+    expect(current.orgId).toBeNull();
+    expect(current.orgRole).toBeNull();
+    expect(current.orgSlug).toBeNull();
+    expect(current.has).toBeInstanceOf(Function);
+    expect(current.has?.({ permission: 'test' })).toBe(false);
+  });
+
+  it('with `treatPendingAsSignedOut: false` option, returns signed in state when session has pending status', () => {
+    const authObject = {
+      sessionId: 'session123',
+      sessionStatus: 'pending',
+      userId: 'user123',
+      actor: 'actor123',
+      orgId: 'org123',
+      orgRole: 'admin',
+      orgSlug: 'my-org',
+      signOut: vi.fn(),
+      getToken: vi.fn(),
+    };
+
+    const {
+      result: { current },
+    } = renderHook(() => useDerivedAuth(authObject, { treatPendingAsSignedOut: false }));
+
+    expect(current.isLoaded).toBe(true);
+    expect(current.isSignedIn).toBe(true);
+    expect(current.sessionId).toBe('session123');
+    expect(current.userId).toBe('user123');
+    expect(current.actor).toBe('actor123');
+    expect(current.orgId).toBe('org123');
+    expect(current.orgRole).toBe('admin');
+    expect(current.orgSlug).toBe('my-org');
+    expect(typeof current.has).toBe('function');
+    expect(current.signOut).toBe(authObject.signOut);
+    expect(current.getToken).toBe(authObject.getToken);
+  });
+
   it('returns signed in with org context when sessionId, userId, orgId, and orgRole are present', () => {
     const authObject = {
       sessionId: 'session123',
diff --git a/packages/react/src/hooks/__tests__/useAuth.type.test.ts b/packages/react/src/hooks/__tests__/useAuth.type.test.ts
index 6f1b5ad78b8..47ee7b0337f 100644
--- a/packages/react/src/hooks/__tests__/useAuth.type.test.ts
+++ b/packages/react/src/hooks/__tests__/useAuth.type.test.ts
@@ -1,7 +1,9 @@
+import type { PendingSessionOptions } from '@clerk/types';
 import { describe, expectTypeOf, it } from 'vitest';
 
 import type { useAuth } from '../useAuth';
 
+type UseAuthParameters = Parameters<typeof useAuth>[0];
 type HasFunction = Exclude<ReturnType<typeof useAuth>['has'], undefined>;
 type ParamsOfHas = Parameters<HasFunction>[0];
 
@@ -111,4 +113,18 @@ describe('useAuth type tests', () => {
       } as const).not.toMatchTypeOf<ParamsOfHas>();
     });
   });
+
+  describe('with parameters', () => {
+    it('allows passing any auth state object', () => {
+      expectTypeOf({ orgId: null }).toMatchTypeOf<UseAuthParameters>();
+    });
+
+    it('do not allow invalid option types', () => {
+      const invalidValue = 5;
+      expectTypeOf({ treatPendingAsSignedOut: invalidValue } satisfies Record<
+        keyof PendingSessionOptions,
+        any
+      >).toMatchTypeOf<UseAuthParameters>();
+    });
+  });
 });
diff --git a/packages/react/src/hooks/useAuth.ts b/packages/react/src/hooks/useAuth.ts
index a807a277145..756d85e2145 100644
--- a/packages/react/src/hooks/useAuth.ts
+++ b/packages/react/src/hooks/useAuth.ts
@@ -1,5 +1,12 @@
-import { createCheckAuthorization } from '@clerk/shared/authorization';
-import type { CheckAuthorizationWithCustomPermissions, GetToken, SignOut, UseAuthReturn } from '@clerk/types';
+import { createCheckAuthorization, resolveAuthState } from '@clerk/shared/authorization';
+import { eventMethodCalled } from '@clerk/shared/telemetry';
+import type {
+  CheckAuthorizationWithCustomPermissions,
+  GetToken,
+  PendingSessionOptions,
+  SignOut,
+  UseAuthReturn,
+} from '@clerk/types';
 import { useCallback } from 'react';
 
 import { useAuthContext } from '../contexts/AuthContext';
@@ -9,6 +16,10 @@ import { invalidStateError } from '../errors/messages';
 import { useAssertWrappedByClerkProvider } from './useAssertWrappedByClerkProvider';
 import { createGetToken, createSignOut } from './utils';
 
+type Nullish<T> = T | undefined | null;
+type InitialAuthState = Record<string, any>;
+type UseAuthOptions = Nullish<InitialAuthState | PendingSessionOptions>;
+
 /**
  * The `useAuth()` hook provides access to the current user's authentication state and methods to manage the active session.
  *
@@ -71,9 +82,12 @@ import { createGetToken, createSignOut } from './utils';
  * </Tab>
  * </Tabs>
  */
-export const useAuth = (initialAuthState: any = {}): UseAuthReturn => {
+export const useAuth = (initialAuthStateOrOptions: UseAuthOptions = {}): UseAuthReturn => {
   useAssertWrappedByClerkProvider('useAuth');
 
+  const { treatPendingAsSignedOut, ...rest } = initialAuthStateOrOptions ?? {};
+  const initialAuthState = rest as any;
+
   const authContextFromHook = useAuthContext();
   let authContext = authContextFromHook;
 
@@ -81,24 +95,23 @@ export const useAuth = (initialAuthState: any = {}): UseAuthReturn => {
     authContext = initialAuthState != null ? initialAuthState : {};
   }
 
-  const { sessionId, userId, actor, orgId, orgRole, orgSlug, orgPermissions, factorVerificationAge } = authContext;
   const isomorphicClerk = useIsomorphicClerkContext();
-
   const getToken: GetToken = useCallback(createGetToken(isomorphicClerk), [isomorphicClerk]);
   const signOut: SignOut = useCallback(createSignOut(isomorphicClerk), [isomorphicClerk]);
 
-  return useDerivedAuth({
-    sessionId,
-    userId,
-    actor,
-    orgId,
-    orgSlug,
-    orgRole,
-    getToken,
-    signOut,
-    orgPermissions,
-    factorVerificationAge,
-  });
+  isomorphicClerk.telemetry?.record(eventMethodCalled('useAuth', { treatPendingAsSignedOut }));
+
+  return useDerivedAuth(
+    {
+      ...authContext,
+      getToken,
+      signOut,
+    },
+    {
+      treatPendingAsSignedOut:
+        treatPendingAsSignedOut ?? isomorphicClerk.__internal_getOption?.('treatPendingAsSignedOut'),
+    },
+  );
 };
 
 /**
@@ -127,20 +140,11 @@ export const useAuth = (initialAuthState: any = {}): UseAuthReturn => {
  * } = useDerivedAuth(authObject);
  * ```
  */
-export function useDerivedAuth(authObject: any): UseAuthReturn {
-  const {
-    sessionId,
-    userId,
-    actor,
-    orgId,
-    orgSlug,
-    orgRole,
-    has,
-    signOut,
-    getToken,
-    orgPermissions,
-    factorVerificationAge,
-  } = authObject ?? {};
+export function useDerivedAuth(
+  authObject: any,
+  { treatPendingAsSignedOut = true }: PendingSessionOptions = {},
+): UseAuthReturn {
+  const { userId, orgId, orgRole, has, signOut, getToken, orgPermissions, factorVerificationAge } = authObject ?? {};
 
   const derivedHas = useCallback(
     (params: Parameters<CheckAuthorizationWithCustomPermissions>[0]) => {
@@ -155,72 +159,24 @@ export function useDerivedAuth(authObject: any): UseAuthReturn {
         factorVerificationAge,
       })(params);
     },
-    [userId, factorVerificationAge, orgId, orgRole, orgPermissions],
+    [has, userId, orgId, orgRole, orgPermissions, factorVerificationAge],
   );
 
-  if (sessionId === undefined && userId === undefined) {
-    return {
-      isLoaded: false,
-      isSignedIn: undefined,
-      sessionId,
-      userId,
-      actor: undefined,
-      orgId: undefined,
-      orgRole: undefined,
-      orgSlug: undefined,
-      has: undefined,
-      signOut,
+  const payload = resolveAuthState({
+    authObject: {
+      ...authObject,
       getToken,
-    };
-  }
-
-  if (sessionId === null && userId === null) {
-    return {
-      isLoaded: true,
-      isSignedIn: false,
-      sessionId,
-      userId,
-      actor: null,
-      orgId: null,
-      orgRole: null,
-      orgSlug: null,
-      has: () => false,
       signOut,
-      getToken,
-    };
-  }
-
-  if (!!sessionId && !!userId && !!orgId && !!orgRole) {
-    return {
-      isLoaded: true,
-      isSignedIn: true,
-      sessionId,
-      userId,
-      actor: actor || null,
-      orgId,
-      orgRole,
-      orgSlug: orgSlug || null,
       has: derivedHas,
-      signOut,
-      getToken,
-    };
-  }
+    },
+    options: {
+      treatPendingAsSignedOut,
+    },
+  });
 
-  if (!!sessionId && !!userId && !orgId) {
-    return {
-      isLoaded: true,
-      isSignedIn: true,
-      sessionId,
-      userId,
-      actor: actor || null,
-      orgId: null,
-      orgRole: null,
-      orgSlug: null,
-      has: derivedHas,
-      signOut,
-      getToken,
-    };
+  if (!payload) {
+    return errorThrower.throw(invalidStateError);
   }
 
-  return errorThrower.throw(invalidStateError);
+  return payload;
 }
diff --git a/packages/react/src/isomorphicClerk.ts b/packages/react/src/isomorphicClerk.ts
index 0c5ce92ceb6..f57b3f823dc 100644
--- a/packages/react/src/isomorphicClerk.ts
+++ b/packages/react/src/isomorphicClerk.ts
@@ -197,8 +197,13 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk {
     return this.#proxyUrl || '';
   }
 
+  /**
+   * Accesses private options from the `Clerk` instance and defaults to
+   * `IsomorphicClerk` options when in SSR context.
+   *  @internal
+   */
   public __internal_getOption<K extends keyof ClerkOptions>(key: K): ClerkOptions[K] | undefined {
-    return this.clerkjs?.__internal_getOption(key);
+    return this.clerkjs?.__internal_getOption ? this.clerkjs?.__internal_getOption(key) : this.options[key];
   }
 
   constructor(options: IsomorphicClerkOptions) {
diff --git a/packages/shared/src/authorization.ts b/packages/shared/src/authorization.ts
index fcabe414ae9..a49da464b3c 100644
--- a/packages/shared/src/authorization.ts
+++ b/packages/shared/src/authorization.ts
@@ -1,10 +1,16 @@
 import type {
+  ActClaim,
   CheckAuthorizationWithCustomPermissions,
+  GetToken,
   OrganizationCustomPermissionKey,
   OrganizationCustomRoleKey,
+  PendingSessionOptions,
   ReverificationConfig,
+  SessionStatusClaim,
   SessionVerificationLevel,
   SessionVerificationTypes,
+  SignOut,
+  UseAuthReturn,
 } from '@clerk/types';
 
 type TypesToConfig = Record<SessionVerificationTypes, Exclude<ReverificationConfig, SessionVerificationTypes>>;
@@ -159,4 +165,111 @@ const createCheckAuthorization = (options: AuthorizationOptions): CheckAuthoriza
   };
 };
 
-export { createCheckAuthorization, validateReverificationConfig };
+type AuthStateOptions = {
+  authObject: {
+    userId?: string | null;
+    sessionId?: string | null;
+    sessionStatus?: SessionStatusClaim | null;
+    actor?: ActClaim | null;
+    orgId?: string | null;
+    orgRole?: OrganizationCustomRoleKey | null;
+    orgSlug?: string | null;
+    orgPermissions?: OrganizationCustomPermissionKey[] | null;
+    getToken: GetToken;
+    signOut: SignOut;
+    has: (params: Parameters<CheckAuthorizationWithCustomPermissions>[0]) => boolean;
+  };
+  options: PendingSessionOptions;
+};
+
+/**
+ * Shared utility function that centralizes auth state resolution logic,
+ * preventing duplication across different packages
+ * @internal
+ */
+const resolveAuthState = ({
+  authObject: { sessionId, sessionStatus, userId, actor, orgId, orgRole, orgSlug, signOut, getToken, has },
+  options: { treatPendingAsSignedOut = true },
+}: AuthStateOptions): UseAuthReturn | undefined => {
+  if (sessionId === undefined && userId === undefined) {
+    return {
+      isLoaded: false,
+      isSignedIn: undefined,
+      sessionId,
+      userId,
+      actor: undefined,
+      orgId: undefined,
+      orgRole: undefined,
+      orgSlug: undefined,
+      has: undefined,
+      signOut,
+      getToken,
+    } as const;
+  }
+
+  if (sessionId === null && userId === null) {
+    return {
+      isLoaded: true,
+      isSignedIn: false,
+      sessionId,
+      userId,
+      actor: null,
+      orgId: null,
+      orgRole: null,
+      orgSlug: null,
+      has: () => false,
+      signOut,
+      getToken,
+    } as const;
+  }
+
+  if (treatPendingAsSignedOut && sessionStatus === 'pending') {
+    return {
+      isLoaded: true,
+      isSignedIn: false,
+      sessionId: null,
+      userId: null,
+      actor: null,
+      orgId: null,
+      orgRole: null,
+      orgSlug: null,
+      has: () => false,
+      signOut,
+      getToken,
+    } as const;
+  }
+
+  if (!!sessionId && !!userId && !!orgId && !!orgRole) {
+    return {
+      isLoaded: true,
+      isSignedIn: true,
+      sessionId,
+      userId,
+      actor: actor || null,
+      orgId,
+      orgRole,
+      orgSlug: orgSlug || null,
+      has,
+      signOut,
+      getToken,
+    } as const;
+  }
+
+  if (!!sessionId && !!userId && !orgId) {
+    return {
+      isLoaded: true,
+      isSignedIn: true,
+      sessionId,
+      userId,
+      actor: actor || null,
+      orgId: null,
+      orgRole: null,
+      orgSlug: null,
+      has,
+      signOut,
+      getToken,
+    } as const;
+  }
+};
+
+export { createCheckAuthorization, validateReverificationConfig, resolveAuthState };
diff --git a/packages/vue/src/composables/useAuth.ts b/packages/vue/src/composables/useAuth.ts
index 1fe578e0c22..8d577a57cc6 100644
--- a/packages/vue/src/composables/useAuth.ts
+++ b/packages/vue/src/composables/useAuth.ts
@@ -1,4 +1,12 @@
-import type { CheckAuthorizationWithCustomPermissions, Clerk, GetToken, SignOut, UseAuthReturn } from '@clerk/types';
+import { resolveAuthState } from '@clerk/shared/authorization';
+import type {
+  CheckAuthorizationWithCustomPermissions,
+  Clerk,
+  GetToken,
+  PendingSessionOptions,
+  SignOut,
+  UseAuthReturn,
+} from '@clerk/types';
 import { computed, type ShallowRef, watch } from 'vue';
 
 import { errorThrower } from '../errors/errorThrower';
@@ -48,7 +56,7 @@ function createSignOut(clerk: ShallowRef<Clerk | null>) {
   };
 }
 
-type UseAuth = () => ToComputedRefs<UseAuthReturn>;
+type UseAuth = (options?: PendingSessionOptions) => ToComputedRefs<UseAuthReturn>;
 
 /**
  * Returns the current auth state, the user and session ids and the `getToken`
@@ -72,14 +80,14 @@ type UseAuth = () => ToComputedRefs<UseAuthReturn>;
  *   </div>
  * </template>
  */
-export const useAuth: UseAuth = () => {
-  const { clerk, authCtx } = useClerkContext();
+export const useAuth: UseAuth = (options = {}) => {
+  const { clerk, authCtx, ...contextOptions } = useClerkContext();
 
   const getToken: GetToken = createGetToken(clerk);
   const signOut: SignOut = createSignOut(clerk);
 
   const result = computed<UseAuthReturn>(() => {
-    const { sessionId, userId, actor, orgId, orgRole, orgSlug, orgPermissions } = authCtx.value;
+    const { userId, orgId, orgRole, orgPermissions } = authCtx.value;
 
     const has = (params: Parameters<CheckAuthorizationWithCustomPermissions>[0]) => {
       if (!params?.permission && !params?.role) {
@@ -100,71 +108,23 @@ export const useAuth: UseAuth = () => {
       return false;
     };
 
-    if (sessionId === undefined && userId === undefined) {
-      return {
-        isLoaded: false,
-        isSignedIn: undefined,
-        sessionId,
-        userId,
-        actor: undefined,
-        orgId: undefined,
-        orgRole: undefined,
-        orgSlug: undefined,
-        has: undefined,
-        signOut,
+    const payload = resolveAuthState({
+      authObject: {
+        ...authCtx.value,
         getToken,
-      };
-    }
-
-    if (sessionId === null && userId === null) {
-      return {
-        isLoaded: true,
-        isSignedIn: false,
-        sessionId,
-        userId,
-        actor: null,
-        orgId: null,
-        orgRole: null,
-        orgSlug: null,
-        has: () => false,
         signOut,
-        getToken,
-      };
-    }
-
-    if (!!sessionId && !!userId && !!orgId && !!orgRole) {
-      return {
-        isLoaded: true,
-        isSignedIn: true,
-        sessionId,
-        userId,
-        actor: actor || null,
-        orgId,
-        orgRole,
-        orgSlug: orgSlug || null,
         has,
-        signOut,
-        getToken,
-      };
-    }
+      },
+      options: {
+        treatPendingAsSignedOut: options.treatPendingAsSignedOut ?? contextOptions.treatPendingAsSignedOut,
+      },
+    });
 
-    if (!!sessionId && !!userId && !orgId) {
-      return {
-        isLoaded: true,
-        isSignedIn: true,
-        sessionId,
-        userId,
-        actor: actor || null,
-        orgId: null,
-        orgRole: null,
-        orgSlug: null,
-        has: () => false,
-        signOut,
-        getToken,
-      };
+    if (!payload) {
+      return errorThrower.throw(invalidStateError);
     }
 
-    return errorThrower.throw(invalidStateError);
+    return payload;
   });
 
   return toComputedRefs(result);
diff --git a/packages/vue/src/plugin.ts b/packages/vue/src/plugin.ts
index 962af33952d..7ee439bbd5a 100644
--- a/packages/vue/src/plugin.ts
+++ b/packages/vue/src/plugin.ts
@@ -83,6 +83,8 @@ export const clerkPlugin: Plugin<[PluginOptions]> = {
       sessionCtx,
       userCtx,
       organizationCtx,
+      treatPendingAsSignedOut:
+        options.treatPendingAsSignedOut ?? clerk.value?.__internal_getOption?.('treatPendingAsSignedOut'),
     });
   },
 };
diff --git a/packages/vue/src/types.ts b/packages/vue/src/types.ts
index b03550e52d2..13767da4855 100644
--- a/packages/vue/src/types.ts
+++ b/packages/vue/src/types.ts
@@ -31,6 +31,7 @@ export interface VueClerkInjectionKeyType {
   sessionCtx: ComputedRef<SignedInSessionResource | null | undefined>;
   userCtx: ComputedRef<UserResource | null | undefined>;
   organizationCtx: ComputedRef<OrganizationResource | null | undefined>;
+  treatPendingAsSignedOut?: boolean;
 }
 
 // Copied from `@clerk/clerk-react`


Reviews:
user: login: panteliselef
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-02T16:33:13Z
user: login: LauraBeatris
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-02T18:36:23Z
user: login: LauraBeatris
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-02T18:47:53Z
user: login: LauraBeatris
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-02T18:55:58Z
user: login: LauraBeatris
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-03T17:36:41Z
user: login: wobsoriano
body: Looks good on the Vue and Astro side. Thanks for abstracting the auth state logic away 🙇🏼 
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-03T19:23:44Z
user: login: LauraBeatris
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-03T21:14:35Z

Review comments:
diff_hunk: @@ -158,69 +165,21 @@ export function useDerivedAuth(authObject: any): UseAuthReturn {
     [userId, factorVerificationAge, orgId, orgRole, orgPermissions],
   );
 
-  if (sessionId === undefined && userId === undefined) {
-    return {
-      isLoaded: false,
-      isSignedIn: undefined,
-      sessionId,
-      userId,
-      actor: undefined,
-      orgId: undefined,
-      orgRole: undefined,
-      orgSlug: undefined,
-      has: undefined,
-      signOut,
+  const payload = resolveAuthState({
+    authContext: {
+      ...authObject,
       getToken,
-    };
-  }
-
-  if (sessionId === null && userId === null) {
-    return {
-      isLoaded: true,
-      isSignedIn: false,
-      sessionId,
-      userId,
-      actor: null,
-      orgId: null,
-      orgRole: null,
-      orgSlug: null,
-      has: () => false,
       signOut,
-      getToken,
-    };
-  }
-
-  if (!!sessionId && !!userId && !!orgId && !!orgRole) {
-    return {
-      isLoaded: true,
-      isSignedIn: true,
-      sessionId,
-      userId,
-      actor: actor || null,
-      orgId,
-      orgRole,
-      orgSlug: orgSlug || null,
       has: derivedHas,
-      signOut,
-      getToken,
-    };
-  }
+    },
+    options: {
+      treatPendingAsSignedOut: treatPendingAsSignedOut ?? clerk?.__internal_getOption('treatPendingAsSignedOut'),
path: packages/react/src/hooks/useAuth.ts
user: login: panteliselef
body: I believe doing `clerk?.__internal_getOption('treatPendingAsSignedOut')` on the server pass will always be undefined, instead we should read directly from the props passed to `ClerkProvider`
created_at: 2025-04-02T16:33:08Z
author_association: CONTRIBUTOR
diff_hunk: @@ -158,69 +165,21 @@ export function useDerivedAuth(authObject: any): UseAuthReturn {
     [userId, factorVerificationAge, orgId, orgRole, orgPermissions],
   );
 
-  if (sessionId === undefined && userId === undefined) {
-    return {
-      isLoaded: false,
-      isSignedIn: undefined,
-      sessionId,
-      userId,
-      actor: undefined,
-      orgId: undefined,
-      orgRole: undefined,
-      orgSlug: undefined,
-      has: undefined,
-      signOut,
+  const payload = resolveAuthState({
+    authContext: {
+      ...authObject,
       getToken,
-    };
-  }
-
-  if (sessionId === null && userId === null) {
-    return {
-      isLoaded: true,
-      isSignedIn: false,
-      sessionId,
-      userId,
-      actor: null,
-      orgId: null,
-      orgRole: null,
-      orgSlug: null,
-      has: () => false,
       signOut,
-      getToken,
-    };
-  }
-
-  if (!!sessionId && !!userId && !!orgId && !!orgRole) {
-    return {
-      isLoaded: true,
-      isSignedIn: true,
-      sessionId,
-      userId,
-      actor: actor || null,
-      orgId,
-      orgRole,
-      orgSlug: orgSlug || null,
       has: derivedHas,
-      signOut,
-      getToken,
-    };
-  }
+    },
+    options: {
+      treatPendingAsSignedOut: treatPendingAsSignedOut ?? clerk?.__internal_getOption('treatPendingAsSignedOut'),
path: packages/react/src/hooks/useAuth.ts
user: login: LauraBeatris
body: I've updated it to read from React context instead! 

For the Astro hook, I believe it's fine to read for `Clerk` if it's loaded on the client, but I'm also defaulting to `true` just in case it resolves to `undefined` on SSR - did the same thing for React as well
created_at: 2025-04-02T18:36:23Z
author_association: MEMBER
diff_hunk: @@ -127,20 +143,11 @@ export const useAuth = (initialAuthState: any = {}): UseAuthReturn => {
  * } = useDerivedAuth(authObject);
  * ```
  */
-export function useDerivedAuth(authObject: any): UseAuthReturn {
-  const {
-    sessionId,
-    userId,
-    actor,
-    orgId,
-    orgSlug,
-    orgRole,
-    has,
-    signOut,
-    getToken,
-    orgPermissions,
-    factorVerificationAge,
-  } = authObject ?? {};
+export function useDerivedAuth(authObject: any, options: PendingSessionOptions = {}): UseAuthReturn {
+  const optionsContext = useOptionsContext();
path: packages/react/src/hooks/useAuth.ts
user: login: LauraBeatris
body: Starting to get this error: 

> <w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (105kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)

I think this is due to `useOptionsContext` being added here, currently investigating
created_at: 2025-04-02T18:47:53Z
author_association: MEMBER
diff_hunk: @@ -158,69 +165,21 @@ export function useDerivedAuth(authObject: any): UseAuthReturn {
     [userId, factorVerificationAge, orgId, orgRole, orgPermissions],
   );
 
-  if (sessionId === undefined && userId === undefined) {
-    return {
-      isLoaded: false,
-      isSignedIn: undefined,
-      sessionId,
-      userId,
-      actor: undefined,
-      orgId: undefined,
-      orgRole: undefined,
-      orgSlug: undefined,
-      has: undefined,
-      signOut,
+  const payload = resolveAuthState({
+    authContext: {
+      ...authObject,
       getToken,
-    };
-  }
-
-  if (sessionId === null && userId === null) {
-    return {
-      isLoaded: true,
-      isSignedIn: false,
-      sessionId,
-      userId,
-      actor: null,
-      orgId: null,
-      orgRole: null,
-      orgSlug: null,
-      has: () => false,
       signOut,
-      getToken,
-    };
-  }
-
-  if (!!sessionId && !!userId && !!orgId && !!orgRole) {
-    return {
-      isLoaded: true,
-      isSignedIn: true,
-      sessionId,
-      userId,
-      actor: actor || null,
-      orgId,
-      orgRole,
-      orgSlug: orgSlug || null,
       has: derivedHas,
-      signOut,
-      getToken,
-    };
-  }
+    },
+    options: {
+      treatPendingAsSignedOut: treatPendingAsSignedOut ?? clerk?.__internal_getOption('treatPendingAsSignedOut'),
path: packages/react/src/hooks/useAuth.ts
user: login: LauraBeatris
body: > we should read directly from the props passed to ClerkProvider

@panteliselef Do you know what's the recommended approach to read `ClerkProvider` options from here? With `useOptionsContext`?
created_at: 2025-04-02T18:55:57Z
author_association: MEMBER
diff_hunk: @@ -158,69 +165,21 @@ export function useDerivedAuth(authObject: any): UseAuthReturn {
     [userId, factorVerificationAge, orgId, orgRole, orgPermissions],
   );
 
-  if (sessionId === undefined && userId === undefined) {
-    return {
-      isLoaded: false,
-      isSignedIn: undefined,
-      sessionId,
-      userId,
-      actor: undefined,
-      orgId: undefined,
-      orgRole: undefined,
-      orgSlug: undefined,
-      has: undefined,
-      signOut,
+  const payload = resolveAuthState({
+    authContext: {
+      ...authObject,
       getToken,
-    };
-  }
-
-  if (sessionId === null && userId === null) {
-    return {
-      isLoaded: true,
-      isSignedIn: false,
-      sessionId,
-      userId,
-      actor: null,
-      orgId: null,
-      orgRole: null,
-      orgSlug: null,
-      has: () => false,
       signOut,
-      getToken,
-    };
-  }
-
-  if (!!sessionId && !!userId && !!orgId && !!orgRole) {
-    return {
-      isLoaded: true,
-      isSignedIn: true,
-      sessionId,
-      userId,
-      actor: actor || null,
-      orgId,
-      orgRole,
-      orgSlug: orgSlug || null,
       has: derivedHas,
-      signOut,
-      getToken,
-    };
-  }
+    },
+    options: {
+      treatPendingAsSignedOut: treatPendingAsSignedOut ?? clerk?.__internal_getOption('treatPendingAsSignedOut'),
path: packages/react/src/hooks/useAuth.ts
user: login: LauraBeatris
body: https://github.com/clerk/javascript/pull/5507#issuecomment-2776497678
created_at: 2025-04-03T17:36:41Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,9 @@
+---
+'@clerk/nextjs': patch
+'@clerk/shared': patch
+'@clerk/astro': patch
+'@clerk/clerk-react': patch
+'@clerk/vue': patch
+---
+
+Update `useAuth` to handle pending sessions as signed-out by default, with opt-out via `useAuth({ treatPendingAsSignedOut: false })` or `<ClerkProvider treatPendingAsSignedOut={false} />`
path: .changeset/modern-paws-mate.md
user: login: LauraBeatris
body: I'll spin up different changeset per package since `<ClerkProvider treatPendingAsSignedOut={false} />` is specific to React
created_at: 2025-04-03T21:14:35Z
author_association: MEMBER

PR comments:
user: login: changeset-bot[bot]
created_at: 2025-04-02T09:53:37Z
body: ###  🦋  Changeset detected

Latest commit: 29503324befcf09deb6ba202313572bcef7d29b6

**The changes in this PR will be included in the next version bump.**

<details><summary>This PR includes changesets to release 19 packages</summary>

  | Name                        | Type  |
| --------------------------- | ----- |
| @clerk/astro                | Minor |
| @clerk/vue                  | Minor |
| @clerk/nextjs               | Patch |
| @clerk/shared               | Patch |
| @clerk/clerk-react          | Patch |
| @clerk/nuxt                 | Patch |
| @clerk/agent-toolkit        | Patch |
| @clerk/backend              | Patch |
| @clerk/chrome-extension     | Patch |
| @clerk/clerk-js             | Patch |
| @clerk/elements             | Patch |
| @clerk/expo-passkeys        | Patch |
| @clerk/clerk-expo           | Patch |
| @clerk/express              | Patch |
| @clerk/fastify              | Patch |
| @clerk/react-router         | Patch |
| @clerk/remix                | Patch |
| @clerk/tanstack-react-start | Patch |
| @clerk/testing              | Patch |

</details>

Not sure what this means? [Click here  to learn what changesets are](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md).

[Click here if you're a maintainer who wants to add another changeset to this PR](https://github.com/clerk/javascript/new/laura/pending-use-auth?filename=.changeset/long-rocks-matter.md&value=---%0A%22%40clerk%2Fastro%22%3A%20patch%0A%22%40clerk%2Fnextjs%22%3A%20patch%0A%22%40clerk%2Fclerk-react%22%3A%20patch%0A%22%40clerk%2Fshared%22%3A%20patch%0A%22%40clerk%2Fvue%22%3A%20patch%0A---%0A%0Achore(shared%2Cvue%2Cnextjs%2Castro%2Cclerk-react)%3A%20Update%20%60useAuth%60%20to%20handle%20pending%20session%20as%20signed-out%0A)


author_association: NONE
user: login: vercel[bot]
created_at: 2025-04-02T09:53:38Z
body: [vc]: #nkPGyvh+7rjgpNWJ7hceMtCPGZuBfwYCH3Ne3SuwO+A=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJjbGVyay1qcy1zYW5kYm94IiwiaW5zcGVjdG9yVXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL2NsZXJrLXByb2R1Y3Rpb24vY2xlcmstanMtc2FuZGJveC81d2dNNWRpZjFaMlhwR1NLYUtnMnJ4aVNERm9GIiwicHJldmlld1VybCI6ImNsZXJrLWpzLXNhbmRib3gtZ2l0LWxhdXJhLXBlbmRpbmctdXNlLWF1dGguY2xlcmtzdGFnZS5kZXYiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQiLCJsaXZlRmVlZGJhY2siOnsicmVzb2x2ZWQiOjAsInVucmVzb2x2ZWQiOjAsInRvdGFsIjowLCJsaW5rIjoiY2xlcmstanMtc2FuZGJveC1naXQtbGF1cmEtcGVuZGluZy11c2UtYXV0aC5jbGVya3N0YWdlLmRldiJ9LCJyb290RGlyZWN0b3J5IjoicGFja2FnZXMvY2xlcmstanMifV19
**The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)

| Name | Status | Preview | Comments | Updated (UTC) |
| :--- | :----- | :------ | :------- | :------ |
| **clerk-js-sandbox** | ✅ Ready ([Inspect](https://vercel.com/clerk-production/clerk-js-sandbox/5wgM5dif1Z2XpGSKaKg2rxiSDFoF)) | [Visit Preview](https://clerk-js-sandbox-git-laura-pending-use-auth.clerkstage.dev) | 💬 [**Add feedback**](https://vercel.live/open-feedback/clerk-js-sandbox-git-laura-pending-use-auth.clerkstage.dev?via=pr-comment-feedback-link) | Apr 3, 2025 9:21pm |


author_association: NONE
user: login: LauraBeatris
created_at: 2025-04-03T17:36:14Z
body: @panteliselef  + @wobsoriano helped me figure out the best approach to pass options between SSR / CSR contexts!

I've made some updates to `useAuth` across Vue, Astro and React, in which it performs the following checks for `treatPendingAsSignedOut`:
- Checks if it passed as parameter: `useAuth({ treatPendingAsSignedOut: false })`
- Checks if it's passed as clerk-js option: `<ClerkProvider treatPendingAsSignedOut />` - or via Vue plugin, Astro integration, etc 
- Defaults to SSR context - for Astro in this case, would be built as an environment variable accessible via `import.meta.env.PUBLIC_CLERK_TREAT_PENDING_AS_SIGNED_OUT`, and for Next.js, we're defaulting to `IsomorphicClerk` options while clerk-js loads 
author_association: MEMBER