Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

More about serverside auth methods

Coppleb70adddb067b
diff --git a/apps/www/_blog/2022-08-16-supabase-js-v2.mdx b/apps/www/_blog/2022-08-16-supabase-js-v2.mdx
index 0585bad37b1..5ab71707c5c 100644
--- a/apps/www/_blog/2022-08-16-supabase-js-v2.mdx
+++ b/apps/www/_blog/2022-08-16-supabase-js-v2.mdx
@@ -50,7 +50,7 @@ const { data } = await supabase.from('messages').select().match({ id: 1 })
v1 also supported types, but the types were generated from the API rather than the database, so it
lost a lot of detailed information. The library also required you to specify the definition in
-every function call, rather than at the client level.
+every method call, rather than at the client level.
```
supabase.from<Database['Message']>('messages').select('*')
@@ -60,7 +60,7 @@ supabase.from<Database['Message']>('messages').select('*')
### New Auth methods
-We're removing the `signIn()` method in favor of more explicit function signatures:
+We're removing the `signIn()` method in favor of more explicit method signatures:
`signInWithPassword()`, `signInWithPasswordless()`, and `signInWithOtp()`.
```ts
@@ -80,9 +80,9 @@ const { data } = await supabase.auth.signIn({
This helps with type hinting. Previously it was difficult for developers to know what they were missing.
A lot of developers didn't even realize they could use passwordless magic links.
-### Data functions return minimal by default
+### Data methods return minimal by default
-The `insert()`, `update()`, and `upsert()` functions now require you to explicitly append `select()` if you want the data to be returned.
+The `insert()`, `update()`, and `upsert()` methods now require you to explicitly append `select()` if you want the data to be returned.
```ts
// v2
@@ -151,9 +151,24 @@ supabase
You can listen to PostgreSQL database changes on any channel you want by subscribing to the `'postgres_changes'` event.
For now, we will continue to support `from().on().subscribe()`, but in the future we will deprecate this in favor of the `channel().on().subscribe()` method.
+### Auth Admin methods
+
+We've move all server-side Auth methods from `supabase.auth.api` to `supabase.auth.admin`:
+
+```ts
+// v2
+const { data: user, error } = await supabase.auth.admin.listUsers()
+
+// v1
+const { data: user, error } = await supabase.auth.api.listUsers()
+```
+
+All `admin` methods expect a `SERVICE_ROLE` key.
+This change makes it clear that any methods under the `admin` namespace should only be used on a trusted server-side environment.
+
### Async Auth overhaul
-We've rebuilt the Auth library, making it async for almost all functions.
+We've rebuilt the Auth library, making it async for almost all methods.
```ts
// v2