惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享
J
Java Code Geeks
Martin Fowler
Martin Fowler
博客园 - Franky
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
S
SegmentFault 最新的问题
B
Blog
The Cloudflare Blog
F
Fortinet All Blogs
量子位
腾讯CDC
博客园 - 司徒正美
D
Docker
大猫的无限游戏
大猫的无限游戏
Microsoft Azure Blog
Microsoft Azure Blog
T
The Blog of Author Tim Ferriss
V
Visual Studio Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
D
DataBreaches.Net
小众软件
小众软件

Clerk Changelog

Largest organizations report Flush elevation option for page-mounted components Groups and custom attributes mapping are now generally available Organizations support in OAuth Applications Improved observability with Application Logs Clerk CLI API Keys General Availability Directory Sync (SCIM) is now generally available Theme Expo native components from a JSON file Infinite scrolling in Overview tables Filter test users in Overview analytics Annual-only plans for Clerk Billing Preview Custom Session Claims Restrict end users from changing their identifiers Clerk Billing now supports plans with seat limits Overview for waitlist mode Clerk is now available in Stripe Projects Organization activity report Create and manage enterprise connections through Clerk's API Native React Native components, Google Sign-In, and Core 3 X social connection improvements JWT format support for M2M tokens Chrome Extension JavaScript SDK support Core 3 Organization retention report Require multi-factor authentication (MFA) on mobile Test enterprise connections with shareable links Clerk Convex integration for Swift and Kotlin Require multi-factor authentication (MFA) Improved visibility into Stripe account status
Official SDK for Astro
Pantelis Eleftheriadis, Robert Soriano · 2024-07-18 · via Clerk Changelog

Astro is one of the most loved web frameworks for the past couple of years, it's a modern framework for fast content-driven websites, while also making it trivial to create dynamic web applications.

Today, we're proud to announce @clerk/astro, a new official SDK that allows developers to add authentication and authorization into their Astro application in matter of minutes.

The SDK comes fully equiped with Clerk's UI components, middleware, and low level utilities for your custom flows.

Use Clerk UI components

Clerk's pre-built UI components give you a beautiful, fully-functional user and organization management experience in minutes. Here's an example on how to use the <SignIn /> component in Astro.

src/pages/sign-in/[...signIn].astro

Protect routes with Clerk Middleware

Use clerkMiddleware and the auth function to restrict logged out users from accessing the /user routes.

src/middleware.ts

Individual page protection

If the /me page is not protected by the middleware, you can still protect the page directly. The code below uses Astro.locals.auth() in order redirect the user the sign-in page or render their userId.

src/pages/me.astro

Usage with React

Astro offers a way to use React inside your Astro application. @clerk/astro takes advantage of that and exposes components, hooks, and utilities for those cases.

src/components/Header.tsx

This is only a quick preview of all that @clerk/astro offers.

For more information on the available API and how to get started building Astro applications with Clerk, check out our Astro Quickstart guide.

And last but not least, we would like to acknowledge and thank all of the contributors of the previous community SDK for Astro, which was a great source of inspiration for us.