Skip to content
Auth

从 Auth Helpers 迁移到 SSR 包

新的 ssr 包将 Auth Helpers 的核心概念提取出来,并让任何服务器语言或框架都可以使用。本页面将指导你如何从 Auth Helpers 包迁移到 ssr

🌐 The new ssr package takes the core concepts of the Auth Helpers and makes them available to any server language or framework. This page will guide you through migrating from the Auth Helpers package to ssr.

替换 Supabase 包 #

🌐 Replacing Supabase packages

1
npm uninstall @supabase/auth-helpers-nextjs
1
npm install @supabase/ssr

创建一个客户端 #

🌐 Creating a client

新的 ssr 包导出了两个用于创建 Supabase 客户端的函数。createBrowserClient 函数用于客户端,createServerClient 函数用于服务器端。

🌐 The new ssr package exports two functions for creating a Supabase client. The createBrowserClient function is used in the client, and the createServerClient function is used in the server.

阅读创建客户端页面,了解在你的框架中创建客户端的示例,以及我们的迁移指南

🌐 Read the Creating a client page for examples of creating a client in your framework and our migration guide.

下一步 #

🌐 Next steps