Skip to content

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

Remove apikey header from autodocs

Joshen Lim0b184be3865a
diff --git a/studio/components/to-be-cleaned/Docs/Pages/Authentication.js b/studio/components/to-be-cleaned/Docs/Pages/Authentication.tsx
similarity index 94%
rename from studio/components/to-be-cleaned/Docs/Pages/Authentication.js
rename to studio/components/to-be-cleaned/Docs/Pages/Authentication.tsx
index 651fe8142e7..bf51409a8c4 100644
--- a/studio/components/to-be-cleaned/Docs/Pages/Authentication.js
+++ b/studio/components/to-be-cleaned/Docs/Pages/Authentication.tsx
@@ -2,7 +2,13 @@ import Link from 'next/link'
import Snippets from '../Snippets'
import CodeSnippet from '../CodeSnippet'
-export default function Authentication({ autoApiService, selectedLang, showApiKey }) {
+interface AuthenticationProps {
+ autoApiService: any
+ selectedLang: string
+ showApiKey: string
+}
+
+const Authentication = ({ autoApiService, selectedLang, showApiKey }: AuthenticationProps) => {
// [Joshen] ShowApiKey should really be a boolean, its confusing
const defaultApiKey =
showApiKey !== 'SUPABASE_KEY'
@@ -101,3 +107,5 @@ export default function Authentication({ autoApiService, selectedLang, showApiKe
</>
)
}
+
+export default Authentication
diff --git a/studio/components/to-be-cleaned/Docs/Snippets.ts b/studio/components/to-be-cleaned/Docs/Snippets.ts
index 44aa501ec92..e8d6e8d676b 100644
--- a/studio/components/to-be-cleaned/Docs/Snippets.ts
+++ b/studio/components/to-be-cleaned/Docs/Snippets.ts
@@ -56,28 +56,27 @@ Future<void> main() async {
}`,
},
}),
- authKey: (title: string, varName: string, apikey: string) => ({
+ authKey: (title: string, varName: string, apiKey: string) => ({
title: `${title}`,
bash: {
language: 'bash',
- code: `${apikey}`,
+ code: `${apiKey}`,
},
js: {
language: 'js',
- code: `const ${varName} = '${apikey}'`,
+ code: `const ${varName} = '${apiKey}'`,
},
}),
authKeyExample: (
defaultApiKey: string,
endpoint: string,
- { keyName, showBearer = true }: { keyName: string; showBearer: boolean }
+ { keyName, showBearer = true }: { keyName?: string; showBearer?: boolean }
) => ({
title: 'Example usage',
bash: {
language: 'bash',
code: `
-curl '${endpoint}/rest/v1/' \\
--H "apikey: ${defaultApiKey}" ${
+curl '${endpoint}/rest/v1/' ${
showBearer
? `\\
-H "Authorization: Bearer ${defaultApiKey}"`
@@ -126,8 +125,7 @@ const supabase = createClient(SUPABASE_URL, process.env.${keyName || 'SUPABASE_K
language: 'bash',
code: `
curl -X POST '${endpoint}/rest/v1/rpc/${rpcName}' \\${bashParams}
--H "Content-Type: application/json" \\
--H "apikey: ${apiKey}" ${
+-H "Content-Type: application/json" ${
showBearer
? `\\
-H "Authorization: Bearer ${apiKey}"`
@@ -253,7 +251,6 @@ const ${listenerName} = supabase.channel('custom-filter-channel')
language: 'bash',
code: `
curl '${endpoint}/rest/v1/${resourceId}?select=*' \\
--H "apikey: ${apiKey}" \\
-H "Authorization: Bearer ${apiKey}"
`,
},
@@ -284,7 +281,6 @@ let { data: ${resourceId}, error } = await supabase
language: 'bash',
code: `
curl '${endpoint}/rest/v1/${resourceId}?select=${columnName}' \\
--H "apikey: ${apiKey}" \\
-H "Authorization: Bearer ${apiKey}"
`,
},
@@ -303,7 +299,6 @@ let { data: ${resourceId}, error } = await supabase
language: 'bash',
code: `
curl '${endpoint}/rest/v1/${resourceId}?select=some_column,other_table(foreign_key)' \\
--H "apikey: ${apiKey}" \\
-H "Authorization: Bearer ${apiKey}"
`,
},
@@ -327,7 +322,6 @@ let { data: ${resourceId}, error } = await supabase
language: 'bash',
code: `
curl '${endpoint}/rest/v1/${resourceId}?select=*' \\
--H "apikey: ${apiKey}" \\
-H "Authorization: Bearer ${apiKey}" \\
-H "Range: 0-9"
`,
@@ -348,7 +342,6 @@ let { data: ${resourceId}, error } = await supabase
language: 'bash',
code: `
curl '${endpoint}/rest/v1/${resourceId}?id=eq.1&select=*' \\
--H "apikey: ${apiKey}" \\
-H "Authorization: Bearer ${apiKey}" \\
-H "Range: 0-9"
`,
@@ -385,7 +378,6 @@ let { data: ${resourceId}, error } = await supabase
language: 'bash',
code: `
curl -X POST '${endpoint}/rest/v1/${resourceId}' \\
--H "apikey: ${apiKey}" \\
-H "Authorization: Bearer ${apiKey}" \\
-H "Content-Type: application/json" \\
-H "Prefer: return=minimal" \\
@@ -410,7 +402,6 @@ const { data, error } = await supabase
language: 'bash',
code: `
curl -X POST '${endpoint}/rest/v1/${resourceId}' \\
--H "apikey: ${apiKey}" \\
-H "Authorization: Bearer ${apiKey}" \\
-H "Content-Type: application/json" \\
-d '[{ "some_column": "someValue" }, { "other_column": "otherValue" }]'
@@ -435,7 +426,6 @@ const { data, error } = await supabase
language: 'bash',
code: `
curl -X POST '${endpoint}/rest/v1/${resourceId}' \\
--H "apikey: ${apiKey}" \\
-H "Authorization: Bearer ${apiKey}" \\
-H "Content-Type: application/json" \\
-H "Prefer: resolution=merge-duplicates" \\
@@ -458,7 +448,6 @@ const { data, error } = await supabase
language: 'bash',
code: `
curl -X PATCH '${endpoint}/rest/v1/${resourceId}?some_column=eq.someValue' \\
--H "apikey: ${apiKey}" \\
-H "Authorization: Bearer ${apiKey}" \\
-H "Content-Type: application/json" \\
-H "Prefer: return=minimal" \\
@@ -482,7 +471,6 @@ const { data, error } = await supabase
language: 'bash',
code: `
curl -X DELETE '${endpoint}/rest/v1/${resourceId}?some_column=eq.someValue' \\
--H "apikey: ${apiKey}" \\
-H "Authorization: Bearer ${apiKey}"
`,
},
@@ -502,7 +490,6 @@ const { error } = await supabase
language: 'bash',
code: `
curl -X POST '${endpoint}/auth/v1/signup' \\
--H "apikey: ${apiKey}" \\
-H "Content-Type: application/json" \\
-d '{
"email": "[email protected]",
@@ -526,7 +513,6 @@ let { data, error } = await supabase.auth.signUp({
language: 'bash',
code: `
curl -X POST '${endpoint}/auth/v1/token?grant_type=password' \\
--H "apikey: ${apiKey}" \\
-H "Content-Type: application/json" \\
-d '{
"email": "[email protected]",
@@ -550,7 +536,6 @@ let { data, error } = await supabase.auth.signInWithPassword({
language: 'bash',
code: `
curl -X POST '${endpoint}/auth/v1/magiclink' \\
--H "apikey: ${apiKey}" \\
-H "Content-Type: application/json" \\
-d '{
"email": "[email protected]"
@@ -572,7 +557,6 @@ let { data, error } = await supabase.auth.signInWithOtp({
language: 'bash',
code: `
curl -X POST '${endpoint}/auth/v1/signup' \\
--H "apikey: ${apiKey}" \\
-H "Content-Type: application/json" \\
-d '{
"phone": "+13334445555",
@@ -596,7 +580,6 @@ let { data, error } = await supabase.auth.signUp({
language: 'bash',
code: `
curl -X POST '${endpoint}/auth/v1/otp' \\
--H "apikey: ${apiKey}" \\
-H "Content-Type: application/json" \\
-d '{
"phone": "+13334445555"
@@ -618,7 +601,6 @@ let { data, error } = await supabase.auth.signInWithOtp({
language: 'bash',
code: `
curl -X POST '${endpoint}/auth/v1/verify' \\
--H "apikey: ${apiKey}" \\
-H "Content-Type: application/json" \\
-d '{
"type": "sms",
@@ -644,7 +626,6 @@ let { data, error } = await supabase.auth.verifyOtp({
language: 'bash',
code: `
curl -X POST '${endpoint}/auth/v1/invite' \\
--H "apikey: ${apiKey}" \\
-H "Authorization: Bearer ${apiKey}" \\
-H "Content-Type: application/json" \\
-d '{
@@ -680,7 +661,6 @@ let { data, error } = await supabase.auth.signInWithOAuth({
language: 'bash',
code: `
curl -X GET '${endpoint}/auth/v1/user' \\
--H "apikey: ${apiKey}" \\
-H "Authorization: Bearer USER_TOKEN"
`,
},
@@ -697,7 +677,6 @@ const { data: { user } } = await supabase.auth.getUser()
language: 'bash',
code: `
curl -X POST '${endpoint}/auth/v1/recover' \\
--H "apikey: ${apiKey}" \\
-H "Content-Type: application/json" \\
-d '{
"email": "[email protected]"
@@ -717,7 +696,6 @@ let { data, error } = await supabase.auth.resetPasswordForEmail(email)
language: 'bash',
code: `
curl -X PUT '${endpoint}/auth/v1/user' \\
--H "apikey: ${apiKey}" \\
-H "Authorization: Bearer <USERS-ACCESS-TOKEN>" \\
-H "Content-Type: application/json" \\
-d '{
@@ -746,7 +724,6 @@ const { data, error } = await supabase.auth.updateUser({
language: 'bash',
code: `
curl -X POST '${endpoint}/auth/v1/logout' \\
--H "apikey: ${apiKey}" \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer USER_TOKEN"
`,