Skip to content

chore(backend,express): Introduce treatPendingAsSignedOut option to getAuth #5842

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

LauraBeatris
Copy link
Member

@LauraBeatris LauraBeatris commented May 5, 2025

Description

Allows passing treatPendingAsSignedOut to getAuth

// `pending` sessions will be treated as signed-out by default
const { userId } = getAuth(req)
// Both `active` and `pending` sessions will be treated as authenticated when `treatPendingAsSignedOut` is false
const { userId } = getAuth(req, { treatPendingAsSignedOut: false })

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Copy link

vercel bot commented May 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 5, 2025 10:08pm

@LauraBeatris LauraBeatris self-assigned this May 5, 2025
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-3 branch from 080f453 to b81ca7e Compare May 5, 2025 20:01
Copy link

changeset-bot bot commented May 5, 2025

🦋 Changeset detected

Latest commit: 17c8480

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

This PR includes changesets to release 11 packages
Name Type
@clerk/backend Minor
@clerk/express Minor
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-3 branch from b81ca7e to 3a2bd6c Compare May 5, 2025 20:32
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-3 branch from 3a2bd6c to 4d7ae6b Compare May 5, 2025 21:57
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-3 branch from 4d7ae6b to 4d75ad8 Compare May 5, 2025 22:04
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-3 branch from 4d75ad8 to 17c8480 Compare May 5, 2025 22:08
@LauraBeatris LauraBeatris requested a review from a team May 5, 2025 22:10
@LauraBeatris LauraBeatris marked this pull request as ready for review May 5, 2025 22:12
Copy link
Member

@brkalow brkalow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -99,7 +99,14 @@ export function signedIn(
afterSignInUrl: authenticateContext.afterSignInUrl || '',
after#Url: authenticateContext.after#Url || '',
isSignedIn: true,
toAuth: () => authObject,
// @ts-expect-error The return type is intentionally overridden here to support consumer-facing logic that treats pending sessions as signed out. This override does not affect internal session management like handshake flows.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 Is it possible to adjust the type so we don't need this?

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants