Skip to content

chore(astro): Introduce treatPendingAsSignedOut option to server-side utilities #5757

New issue

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

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

Already on GitHub? Sign in 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 Apr 29, 2025

Description

Allow passing treatPendingAsSignedOut to auth, getAuth, and server-side control components.

const { userId } = getAuth(req, { treatPendingAsSignedOut: false })
clerkMiddleware((auth, context) => {
  const { redirectToSignIn, userId } = auth({ treatPendingAsSignedOut: false })

  // Both `active` and `pending` sessions will be treated as authenticated when `treatPendingAsSignedOut` is false
  if (!userId && isProtectedRoute(context.request)) {
    return redirectToSignIn()
  }
})

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

changeset-bot bot commented Apr 29, 2025

🦋 Changeset detected

Latest commit: 3e4719f

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

This PR includes changesets to release 1 package
Name Type
@clerk/astro Minor

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

Copy link

vercel bot commented Apr 29, 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:14pm

@LauraBeatris LauraBeatris changed the title chore(astro): Introduce treatPendingAsSignedOut to getAuth [wip] chore(astro): Introduce treatPendingAsSignedOut to server-side utilities Apr 29, 2025
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-2 branch from 5caf2fd to eb1b8fd Compare April 30, 2025 15:35
@LauraBeatris LauraBeatris changed the title [wip] chore(astro): Introduce treatPendingAsSignedOut to server-side utilities chore(astro): Introduce treatPendingAsSignedOut to server-side utilities Apr 30, 2025
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-2 branch from eb1b8fd to 1e792af Compare April 30, 2025 15:37
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-2 branch from 1e792af to 15c54b7 Compare April 30, 2025 15:40
@LauraBeatris LauraBeatris self-assigned this Apr 30, 2025
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-2 branch from 15c54b7 to 239d32e Compare April 30, 2025 15:53
@LauraBeatris LauraBeatris requested a review from a team April 30, 2025 16:00
@LauraBeatris LauraBeatris marked this pull request as ready for review April 30, 2025 16:14
@LauraBeatris LauraBeatris marked this pull request as draft April 30, 2025 16:17
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-2 branch from 239d32e to 57af90b Compare April 30, 2025 19:41
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-2 branch from 57af90b to 17c946c Compare May 5, 2025 17:21
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-2 branch from 17c946c to 00525a0 Compare May 5, 2025 18:54
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-2 branch from 00525a0 to 4fd9834 Compare May 5, 2025 19:00
@LauraBeatris LauraBeatris marked this pull request as ready for review May 5, 2025 19:05
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-2 branch from 4fd9834 to d952599 Compare May 5, 2025 19:06
@LauraBeatris LauraBeatris changed the title chore(astro): Introduce treatPendingAsSignedOut to server-side utilities chore(astro): Introduce treatPendingAsSignedOut option to server-side utilities May 5, 2025
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-2 branch from 3569919 to bc07bf3 Compare May 5, 2025 19:58
@LauraBeatris LauraBeatris force-pushed the laura/orgs-621-sdk-introduce-treatpendingassignedout-option-across-sdk-2 branch from bc07bf3 to 3e4719f Compare May 5, 2025 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants