Skip to content

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

fix: replace SUPABASE_ANON_KEY with SUPABASE_SERVICE_KEY to silent User not allowed error

phamhieu7e61af3dcb85
diff --git a/studio/pages/api/auth/[ref]/invite.ts b/studio/pages/api/auth/[ref]/invite.ts
index e8d0b15d218..5e626df5f59 100644
--- a/studio/pages/api/auth/[ref]/invite.ts
+++ b/studio/pages/api/auth/[ref]/invite.ts
@@ -21,7 +21,7 @@ const handlePost = async (req: NextApiRequest, res: NextApiResponse) => {
const headers = constructHeaders({
'Content-Type': 'application/json',
Accept: 'application/json',
- Authorization: `Bearer ${process.env.SUPABASE_ANON_KEY}`,
+ Authorization: `Bearer ${process.env.SUPABASE_SERVICE_KEY}`,
})
const url = `${process.env.SUPABASE_URL}/auth/v1/invite`
const payload = { email: req.body.email }
diff --git a/studio/pages/api/auth/[ref]/magiclink.ts b/studio/pages/api/auth/[ref]/magiclink.ts
index 9bfc6237527..50c25e9199e 100644
--- a/studio/pages/api/auth/[ref]/magiclink.ts
+++ b/studio/pages/api/auth/[ref]/magiclink.ts
@@ -24,7 +24,7 @@ const handlePost = async (req: NextApiRequest, res: NextApiResponse) => {
const headers = constructHeaders({
'Content-Type': 'application/json',
Accept: 'application/json',
- Authorization: `Bearer ${process.env.SUPABASE_ANON_KEY}`,
+ Authorization: `Bearer ${process.env.SUPABASE_SERVICE_KEY}`,
})
const url = `${process.env.SUPABASE_URL}/auth/v1/magiclink`
const payload = { email: req.body.email }
diff --git a/studio/pages/api/auth/[ref]/otp.ts b/studio/pages/api/auth/[ref]/otp.ts
index 03bf68cd6cf..e9e8892a388 100644
--- a/studio/pages/api/auth/[ref]/otp.ts
+++ b/studio/pages/api/auth/[ref]/otp.ts
@@ -24,7 +24,7 @@ const handlePost = async (req: NextApiRequest, res: NextApiResponse) => {
const headers = constructHeaders({
'Content-Type': 'application/json',
Accept: 'application/json',
- Authorization: `Bearer ${process.env.SUPABASE_ANON_KEY}`,
+ Authorization: `Bearer ${process.env.SUPABASE_SERVICE_KEY}`,
})
const url = `${process.env.SUPABASE_URL}/auth/v1/otp`
const payload = { phone: req.body.phone }
diff --git a/studio/pages/api/auth/[ref]/recover.ts b/studio/pages/api/auth/[ref]/recover.ts
index 4226d1612d2..6a05ff85708 100644
--- a/studio/pages/api/auth/[ref]/recover.ts
+++ b/studio/pages/api/auth/[ref]/recover.ts
@@ -24,7 +24,7 @@ const handlePost = async (req: NextApiRequest, res: NextApiResponse) => {
const headers = constructHeaders({
'Content-Type': 'application/json',
Accept: 'application/json',
- Authorization: `Bearer ${process.env.SUPABASE_ANON_KEY}`,
+ Authorization: `Bearer ${process.env.SUPABASE_SERVICE_KEY}`,
})
const url = `${process.env.SUPABASE_URL}/auth/v1/recover`
const payload = { email: req.body.email }