mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
Merge branch 'master' into chore/optimize-docs-side-menus
This commit is contained in:
commit
d5405f5381
441 files changed
+30295
-16582
No files matched your search
@@ -1,10 +1,15 @@
|
||||
name: Mirror Image
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
type: string
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Image tag"
|
||||
description: 'Image tag'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
|
||||
@@ -14,29 +14,39 @@ on:
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
settings:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
outputs:
|
||||
image_version: ${{ steps.meta.outputs.version }}
|
||||
steps:
|
||||
- id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
supabase/studio
|
||||
public.ecr.aws/supabase/studio
|
||||
ghcr.io/supabase/studio
|
||||
flavor: |
|
||||
latest=false
|
||||
tags: |
|
||||
type=ref,event=tag
|
||||
type=sha,prefix={{date 'YYYYMMDD'}},enable=${{ github.ref_type == 'branch' }}
|
||||
type=raw,value=${{ inputs.version }},enable=${{ github.event_name != 'push' }}
|
||||
type=sha,prefix={{date 'YYYYMMDD'}}-,enable=${{ github.event_name == 'push' && github.ref_type == 'branch' }}
|
||||
type=raw,value=${{ inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }}
|
||||
|
||||
- uses: docker/setup-qemu-action@v2
|
||||
release_x86:
|
||||
needs: settings
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
env:
|
||||
arch: amd64
|
||||
outputs:
|
||||
image_digest: ${{ steps.build.outputs.digest }}
|
||||
steps:
|
||||
- id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
platforms: amd64,arm64
|
||||
images: |
|
||||
supabase/studio
|
||||
tags: |
|
||||
type=raw,value=${{ needs.settings.outputs.image_version }}_${{ env.arch }}
|
||||
|
||||
- uses: docker/setup-buildx-action@v2
|
||||
|
||||
@@ -46,27 +56,86 @@ jobs:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Login to ECR
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: public.ecr.aws
|
||||
username: ${{ secrets.PROD_ACCESS_KEY_ID }}
|
||||
password: ${{ secrets.PROD_SECRET_ACCESS_KEY }}
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- uses: docker/build-push-action@v3
|
||||
- id: build
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
push: true
|
||||
context: '{{defaultContext}}'
|
||||
file: studio/Dockerfile
|
||||
target: production
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: linux/${{ env.arch }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
release_arm:
|
||||
needs: settings
|
||||
runs-on: arm-runner
|
||||
timeout-minutes: 120
|
||||
env:
|
||||
arch: arm64
|
||||
outputs:
|
||||
image_digest: ${{ steps.build.outputs.digest }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
supabase/studio
|
||||
tags: |
|
||||
type=raw,value=${{ needs.settings.outputs.image_version }}_${{ env.arch }}
|
||||
|
||||
- uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- uses: docker/setup-buildx-action@v2
|
||||
with:
|
||||
driver: docker
|
||||
driver-opts: |
|
||||
image=moby/buildkit:master
|
||||
network=host
|
||||
|
||||
- id: build
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
push: true
|
||||
context: .
|
||||
file: studio/Dockerfile
|
||||
target: production
|
||||
platforms: linux/${{ env.arch }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
no-cache: true
|
||||
|
||||
merge_manifest:
|
||||
needs:
|
||||
- settings
|
||||
- release_x86
|
||||
- release_arm
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: docker/setup-buildx-action@v2
|
||||
|
||||
- uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Merge multi-arch manifests
|
||||
run: |
|
||||
docker buildx imagetools create -t supabase/studio:${{ needs.settings.outputs.image_version }} \
|
||||
supabase/studio@${{ needs.release_x86.outputs.image_digest }} \
|
||||
supabase/studio@${{ needs.release_arm.outputs.image_digest }}
|
||||
|
||||
publish:
|
||||
needs:
|
||||
- settings
|
||||
- merge_manifest
|
||||
# Call workflow explicitly because events from actions cannot trigger more actions
|
||||
uses: ./.github/workflows/mirror.yml
|
||||
with:
|
||||
version: ${{ needs.settings.outputs.image_version }}
|
||||
secrets: inherit
|
||||
@@ -8,6 +8,7 @@
|
||||
- [Running turborepo](#running-turborepo)
|
||||
- [Shared components](#shared-components)
|
||||
- [Installing packages](#installing-packages)
|
||||
- [New Supabase docs](#new-supabase-docs)
|
||||
3. [Create a pull request](#create-a-pull-request)
|
||||
|
||||
- [Common tasks](#common-tasks)
|
||||
@@ -106,6 +107,14 @@ For example:
|
||||
|
||||
You do not need to install `devDependencies` in each workspace. These can all be installed in the root package.
|
||||
|
||||
#### New Supabase docs
|
||||
|
||||
Following the changes to the [Supabase docs](https://supabase.com/blog/new-supabase-docs-built-with-nextjs) the following is needed to run the new docs locally:
|
||||
|
||||
- Inside of `apps/docs` create a `.env.local` file with the following: `NEXT_PUBLIC_NEW_DOCS=true`
|
||||
|
||||
Now when you run a local devlopment docs server you will see the new docs site.
|
||||
|
||||
---
|
||||
|
||||
## Create a pull request
|
||||
|
||||
@@ -142,7 +142,7 @@ Our approach for client libraries is modular. Each sub-library is a standalone i
|
||||
<td>-</td>
|
||||
<td><a href="https://github.com/supabase-community/gotrue-java" target="_blank" rel="noopener noreferrer">gotrue-java</a></td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td><a href="https://github.com/supabase-community/storage-java" target="_blanke" rel="noopener noreferrer">storage-java</a></td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -20,7 +20,6 @@ function SearchProviderContent({ children }: any) {
|
||||
const router = useRouter()
|
||||
const [isOpen, setIsOpen] = useState(false)
|
||||
const [initialQuery, setInitialQuery] = useState(null)
|
||||
|
||||
const onOpen = useCallback(() => {
|
||||
setIsOpen(true)
|
||||
}, [setIsOpen])
|
||||
@@ -85,6 +84,7 @@ function SearchProviderContent({ children }: any) {
|
||||
hitComponent={Hit}
|
||||
transformItems={(items) => {
|
||||
return items.map((item, index) => {
|
||||
console.log('item', item)
|
||||
// We transform the absolute URL into a relative URL to
|
||||
// leverage Next's preloading.
|
||||
const a = document.createElement('a')
|
||||
@@ -96,7 +96,8 @@ function SearchProviderContent({ children }: any) {
|
||||
...item,
|
||||
url: `${a.pathname}${hash}`,
|
||||
__is_result: () => true,
|
||||
__is_parent: () => item.type === 'lvl1' && items.length > 1 && index === 0,
|
||||
__is_parent: () => item.type === 'lvl1' && index === 0,
|
||||
__is_guide: () => item.hierarchy.lvl0 === 'Guides',
|
||||
__is_child: () =>
|
||||
item.type !== 'lvl1' &&
|
||||
items.length > 1 &&
|
||||
@@ -129,6 +130,7 @@ function Hit({ hit, children }) {
|
||||
'DocSearch-Hit--FirstChild': hit.__is_first?.(),
|
||||
'DocSearch-Hit--LastChild': hit.__is_last?.(),
|
||||
'DocSearch-Hit--Child': hit.__is_child?.(),
|
||||
'DocSearch-Hit--Guide': hit.__is_guide?.(),
|
||||
})}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
import { useTheme } from 'common/Providers'
|
||||
import { IconSun, IconMoon } from '@supabase/ui'
|
||||
|
||||
function DarkModeToggle() {
|
||||
const { isDarkMode, toggleTheme } = useTheme()
|
||||
|
||||
const toggleDarkMode = () => {
|
||||
localStorage.setItem('supabaseDarkMode', (!isDarkMode).toString())
|
||||
toggleTheme()
|
||||
|
||||
const key = localStorage.getItem('supabaseDarkMode')
|
||||
document.documentElement.className = key === 'true' ? 'dark' : ''
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex items-center">
|
||||
<IconSun className="text-scale-900" strokeWidth={2} />
|
||||
<button
|
||||
type="button"
|
||||
aria-pressed="false"
|
||||
className={`
|
||||
relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent
|
||||
transition-colors duration-200 ease-in-out focus:outline-none ${
|
||||
isDarkMode ? 'bg-scale-500' : 'bg-scale-900'
|
||||
} mx-5
|
||||
`}
|
||||
onClick={() => toggleDarkMode()}
|
||||
>
|
||||
<span className="sr-only">Toggle Themes</span>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={`
|
||||
${
|
||||
isDarkMode ? 'translate-x-5' : 'translate-x-0'
|
||||
} dark:bg-scale-300 inline-block h-5 w-5
|
||||
transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out
|
||||
`}
|
||||
/>
|
||||
</button>
|
||||
<IconMoon className="text-scale-900" strokeWidth={2} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default DarkModeToggle
|
||||
@@ -1,133 +0,0 @@
|
||||
import { Badge } from 'ui'
|
||||
import Link from 'next/link'
|
||||
import Image from 'next/image'
|
||||
import FooterLinks from 'data/footer.json'
|
||||
import DarkModeToggle from './DarkModeToggle'
|
||||
import { useTheme } from 'common/Providers'
|
||||
import * as supabaseLogoWordmarkDark from 'common/assets/images/supabase-logo-wordmark--dark.png'
|
||||
import * as supabaseLogoWordmarkLight from 'common/assets/images/supabase-logo-wordmark--light.png'
|
||||
|
||||
const Footer = () => {
|
||||
const { isDarkMode } = useTheme()
|
||||
|
||||
return (
|
||||
<footer
|
||||
className="border-scale-500 dark:border-scale-600 border-t"
|
||||
aria-labelledby="footerHeading"
|
||||
>
|
||||
<h2 id="footerHeading" className="sr-only">
|
||||
Footer
|
||||
</h2>
|
||||
<div className="sm:py-18 container relative mx-auto px-6 py-16 md:py-24 lg:px-16 lg:py-24 xl:px-20">
|
||||
<div className="xl:grid xl:grid-cols-3 xl:gap-8">
|
||||
<div className="space-y-8 xl:col-span-1">
|
||||
<Link href="#" as="/">
|
||||
<a className="w-40">
|
||||
<Image
|
||||
src={isDarkMode ? supabaseLogoWordmarkDark : supabaseLogoWordmarkLight}
|
||||
width={160}
|
||||
height={30}
|
||||
alt="Supabase"
|
||||
/>
|
||||
</a>
|
||||
</Link>
|
||||
<div className="flex space-x-5">
|
||||
<a
|
||||
href="https://twitter.com/supabase"
|
||||
className="text-scale-900 hover:text-scale-1200 transition"
|
||||
>
|
||||
<span className="sr-only">Twitter</span>
|
||||
<svg className="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84" />
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://github.com/supabase"
|
||||
className="text-scale-900 hover:text-scale-1200 transition"
|
||||
>
|
||||
<span className="sr-only">GitHub</span>
|
||||
<svg className="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://discord.supabase.com/"
|
||||
className="text-scale-900 hover:text-scale-1200 transition"
|
||||
>
|
||||
<span className="sr-only">Discord</span>
|
||||
<svg className="h-6 w-6" fill="currentColor" viewBox="0 0 71 55" aria-hidden="true">
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://youtube.com/c/supabase"
|
||||
className="text-scale-900 hover:text-scale-1200 transition"
|
||||
>
|
||||
<span className="sr-only">Youtube</span>
|
||||
<svg
|
||||
className="h-6 w-6"
|
||||
fill="currentColor"
|
||||
viewBox="0 0 576 512"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-12 grid grid-cols-1 gap-8 xl:col-span-2 xl:mt-0">
|
||||
<div className="grid grid-cols-2 gap-8 md:grid-cols-4">
|
||||
{FooterLinks.map((segment: any) => {
|
||||
return (
|
||||
<div key={`footer_${segment.title}`}>
|
||||
<h6 className="text-scale-1200 overwrite text-base">{segment.title}</h6>
|
||||
<ul className="mt-4 space-y-2">
|
||||
{segment.links.map((link: any, idx: number) => (
|
||||
<li key={`${segment.title}_link_${idx}`}>
|
||||
<a
|
||||
href={link.url}
|
||||
className={`text-sm transition-colors ${
|
||||
link.url
|
||||
? 'text-scale-1100 hover:text-scale-1200 '
|
||||
: 'text-scale-900 hover:text-scale-900'
|
||||
} `}
|
||||
>
|
||||
{link.text}
|
||||
{!link.url && (
|
||||
<div className="ml-2 inline text-xs xl:ml-0 xl:block 2xl:ml-2 2xl:inline">
|
||||
<Badge color="scale" size="small">
|
||||
Coming soon
|
||||
</Badge>
|
||||
</div>
|
||||
)}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="border-scale-500 dark:border-scale-600 mt-32 flex justify-between border-t pt-8">
|
||||
<small className="small">© Supabase Inc</small>
|
||||
<DarkModeToggle />
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
)
|
||||
}
|
||||
|
||||
export default Footer
|
||||
@@ -1,11 +1,13 @@
|
||||
const FooterHelpCallout = () => {
|
||||
return (
|
||||
<div className="min-w-full px-8 py-6 prose bg-scale-300 dark:bg-whiteA-200 rounded">
|
||||
<h5 className="text-sm m-0 text-scale-1100">Need some help?</h5>
|
||||
<p className="m-0 text-sm text-scale-900">
|
||||
Not to worry, our specialist engineers are here to help. Submit a support ticket through the{' '}
|
||||
<a href="https://app.supabase.com/support/new">Dashboard</a>.
|
||||
</p>
|
||||
<div className="mt-32">
|
||||
<div className="min-w-full px-8 py-6 prose bg-scale-300 dark:bg-whiteA-200 rounded">
|
||||
<h5 className="text-sm m-0 text-scale-1100">Need some help?</h5>
|
||||
<p className="m-0 text-sm text-scale-900">
|
||||
Not to worry, our specialist engineers are here to help. Submit a support ticket through
|
||||
the <a href="https://app.supabase.com/support/new">Dashboard</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
import Image from 'next/image'
|
||||
import Link from 'next/link'
|
||||
import { Button, IconGitHub, IconTwitter } from '~/../../packages/ui'
|
||||
import footerData from '~/data/footer.json'
|
||||
import { useTheme } from 'common/Providers'
|
||||
|
||||
const Footer = () => {
|
||||
const { isDarkMode } = useTheme()
|
||||
return (
|
||||
<div>
|
||||
<hr className="border-scale-400 mt-8"></hr>
|
||||
<div className="flex gap-4 items-center mt-6 justify-between">
|
||||
<div className="flex flex-col lg:flex-row gap-3 ">
|
||||
<span className="text-xs text-scale-900">Supabase 2022</span>
|
||||
<span className="text-xs text-scale-900">—</span>
|
||||
{footerData.map((item) => (
|
||||
<Link href={item.url}>
|
||||
<a className="text-xs text-scale-800 hover:underline">{item.title}</a>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
type="text"
|
||||
as="a"
|
||||
// @ts-ignore
|
||||
href="https://twitter.com/supabase"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
<IconTwitter size={16} />
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
as="a"
|
||||
// @ts-ignore
|
||||
href="https://discord.supabase.com/"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="16">
|
||||
<path
|
||||
fill="none"
|
||||
fill-rule="nonzero"
|
||||
stroke={`${isDarkMode ? '#fff' : '#333'}`}
|
||||
d="M16.238 2.16a14.628 14.628 0 0 0-3.664-1.159.055.055 0 0 0-.059.028c-.158.288-.333.662-.456.957a13.432 13.432 0 0 0-4.115 0 9.76 9.76 0 0 0-.464-.957.057.057 0 0 0-.058-.028 14.587 14.587 0 0 0-3.664 1.16.053.053 0 0 0-.024.02C1.4 5.74.76 9.21 1.074 12.637c.002.017.011.033.024.043a14.813 14.813 0 0 0 4.494 2.318.058.058 0 0 0 .064-.02c.346-.483.654-.992.92-1.527a.059.059 0 0 0-.032-.08c-.49-.19-.956-.421-1.404-.684a.06.06 0 0 1-.006-.097c.094-.072.189-.148.279-.223a.055.055 0 0 1 .058-.008c2.946 1.372 6.135 1.372 9.046 0a.055.055 0 0 1 .06.007 7.2 7.2 0 0 0 .279.224.06.06 0 0 1-.005.097 9.143 9.143 0 0 1-1.405.683.06.06 0 0 0-.03.081c.27.534.578 1.043.918 1.526.014.02.04.029.063.021A14.763 14.763 0 0 0 18.9 12.68a.06.06 0 0 0 .023-.042c.376-3.962-.628-7.404-2.66-10.455a.046.046 0 0 0-.024-.021Zm-9.223 8.39c-.887 0-1.618-.831-1.618-1.852 0-1.02.717-1.851 1.618-1.851.908 0 1.632.838 1.618 1.851 0 1.02-.717 1.851-1.618 1.851Zm5.981 0c-.887 0-1.618-.831-1.618-1.852 0-1.02.717-1.851 1.618-1.851.908 0 1.632.838 1.618 1.851 0 1.02-.71 1.851-1.618 1.851Z"
|
||||
/>
|
||||
</svg>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Footer
|
||||
@@ -102,6 +102,7 @@ export const menuItems: NavMenu = {
|
||||
{ name: 'Login with Twitch', url: '/guides/auth/auth-twitch', items: [] },
|
||||
{ name: 'Login with Twitter', url: '/guides/auth/auth-twitter', items: [] },
|
||||
{ name: 'Login with WorkOS', url: '/guides/auth/auth-workos', items: [] },
|
||||
{ name: 'Login with Zoom', url: '/guides/auth/auth-zoom', items: [] },
|
||||
{ name: 'Phone Auth with Twilio', url: '/guides/auth/auth-twilio', items: [] },
|
||||
{ name: 'Phone Auth with Vonage', url: '/guides/auth/auth-vonage', items: [] },
|
||||
{
|
||||
@@ -265,6 +266,7 @@ export const menuItems: NavMenu = {
|
||||
url: '/guides/platform/migrating-and-upgrading-projects',
|
||||
items: [],
|
||||
},
|
||||
{ name: 'Network Restrictions', url: '/guides/platform/network-restrictions', items: [] },
|
||||
{ name: 'Performance Tuning', url: '/guides/platform/performance', items: [] },
|
||||
{ name: 'Permissions', url: '/guides/platform/permissions', items: [] },
|
||||
{ name: 'Production Readiness', url: '/guides/platform/going-into-prod', items: [] },
|
||||
|
||||
@@ -63,6 +63,12 @@ const home = [
|
||||
href: '/guides/resources',
|
||||
level: 'resources',
|
||||
},
|
||||
{
|
||||
label: 'Self-Hosting',
|
||||
icon: '/img/icons/menu/platform',
|
||||
href: '/guides/self-hosting',
|
||||
level: 'self_hosting',
|
||||
},
|
||||
{
|
||||
label: 'Integrations',
|
||||
icon: '/img/icons/menu/integrations',
|
||||
|
||||
@@ -240,6 +240,12 @@ export const SocialLoginItems = [
|
||||
url: '/guides/auth/social-login/auth-workos',
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
name: 'Zoom',
|
||||
icon: '/docs/img/icons/zoom-icon',
|
||||
url: '/guides/auth/social-login/auth-zoom',
|
||||
items: [],
|
||||
},
|
||||
]
|
||||
|
||||
export const PhoneLoginsItems = [
|
||||
@@ -247,20 +253,20 @@ export const PhoneLoginsItems = [
|
||||
name: 'MessageBird SMS Login',
|
||||
icon: '/docs/img/icons/messagebird-icon',
|
||||
linkDescription: 'Communication between businesses and their customers — across any channel.',
|
||||
url: '/guides/auth/passwordless-login/phone-sms-otp-messagebird',
|
||||
url: '/guides/auth/phone-login/messagebird',
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
name: 'Twilio SMS Login',
|
||||
icon: '/docs/img/icons/twilio-icon',
|
||||
url: '/guides/auth/passwordless-login/phone-sms-otp-twilio',
|
||||
url: '/guides/auth/phone-login/twilio',
|
||||
linkDescription: 'Customer engagement platform used by hundreds of thousands of businesses.',
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
name: 'Vonage SMS Login',
|
||||
icon: '/docs/img/icons/vonage-icon',
|
||||
url: '/guides/auth/passwordless-login/phone-sms-otp-vonage',
|
||||
url: '/guides/auth/phone-login/vonage',
|
||||
linkDescription:
|
||||
'Vonage is a communication platform as a service (CPaaS) provider for consumers and businesses.',
|
||||
items: [],
|
||||
@@ -281,24 +287,18 @@ export const auth = {
|
||||
url: undefined,
|
||||
items: [
|
||||
{ name: 'Email Login', url: '/guides/auth/auth-email', items: [] },
|
||||
{ name: 'Magic Link Login', url: '/guides/auth/auth-magic-link', items: [] },
|
||||
{
|
||||
name: 'Passwordless Login',
|
||||
url: '/guides/auth/passwordless-login',
|
||||
items: [
|
||||
{
|
||||
name: 'Magic Link Login',
|
||||
icon: '',
|
||||
url: '/guides/auth/passwordless-login/email-otp-magic-link',
|
||||
items: [],
|
||||
},
|
||||
...PhoneLoginsItems,
|
||||
],
|
||||
name: 'Phone Login',
|
||||
url: '/guides/auth/phone-login',
|
||||
items: [...PhoneLoginsItems],
|
||||
},
|
||||
{
|
||||
name: 'Social Login',
|
||||
url: '/guides/auth/social-login',
|
||||
items: [...SocialLoginItems],
|
||||
},
|
||||
{ name: 'Email Templates', url: '/guides/auth/auth-email-templates', items: [] },
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -469,12 +469,14 @@ export const platform = {
|
||||
items: [
|
||||
{ name: 'Compute Add-ons', url: '/guides/platform/compute-add-ons', items: [] },
|
||||
{ name: 'Custom Domains', url: '/guides/platform/custom-domains', items: [] },
|
||||
{ name: 'Database Backups', url: '/guides/platform/backups', items: [] },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Platform Management',
|
||||
url: undefined,
|
||||
items: [
|
||||
{ name: 'Access Control', url: '/guides/platform/access-control', items: [] },
|
||||
{ name: 'Database Usage', url: '/guides/platform/database-usage', items: [] },
|
||||
{ name: 'Logging', url: '/guides/platform/logs', items: [] },
|
||||
{ name: 'Metrics', url: '/guides/platform/metrics', items: [] },
|
||||
@@ -483,10 +485,29 @@ export const platform = {
|
||||
url: '/guides/platform/migrating-and-upgrading-projects',
|
||||
items: [],
|
||||
},
|
||||
{ name: 'Network Restrictions', url: '/guides/platform/network-restrictions', items: [] },
|
||||
{ name: 'Performance Tuning', url: '/guides/platform/performance', items: [] },
|
||||
{ name: 'Permissions', url: '/guides/platform/permissions', items: [] },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Single sign-on',
|
||||
url: undefined,
|
||||
items: [
|
||||
{
|
||||
name: 'Enable SSO for your organization',
|
||||
url: '/guides/platform/sso',
|
||||
items: [],
|
||||
},
|
||||
{ name: 'SSO with Azure AD', url: '/guides/platform/sso/azure', items: [] },
|
||||
{
|
||||
name: 'SSO with Google Workspace',
|
||||
url: '/guides/platform/sso/gsuite',
|
||||
items: [],
|
||||
},
|
||||
{ name: 'SSO with Okta', url: '/guides/platform/sso/okta', items: [] },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Go-live Checklist',
|
||||
url: undefined,
|
||||
@@ -500,7 +521,8 @@ export const resources = {
|
||||
label: 'Resources',
|
||||
url: '/guides/resources',
|
||||
items: [
|
||||
{ name: 'Examples', url: '/guides/resources/examples', items: [] },
|
||||
// removing until the examples page is reworked
|
||||
// { name: 'Examples', url: '/guides/resources/examples', items: [] },
|
||||
{ name: 'Glossary', url: '/guides/resources/glossary', items: [] },
|
||||
{
|
||||
name: 'Migrate to Supabase',
|
||||
@@ -512,8 +534,8 @@ export const resources = {
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
name: 'Firebase Data',
|
||||
url: '/guides/resources/migrating-to-supabase/firebase-data',
|
||||
name: 'Firestore Data',
|
||||
url: '/guides/resources/migrating-to-supabase/firestore-data',
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
@@ -543,37 +565,7 @@ export const resources = {
|
||||
},
|
||||
{
|
||||
name: 'Managing Environments',
|
||||
url: '/guides/cli/managing-environments',
|
||||
items: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Self-Hosting',
|
||||
items: [
|
||||
{ name: 'Overview', url: '/guides/resources/self-hosting', items: [] },
|
||||
{ name: 'Docker', url: '/guides/resources/self-hosting/docker', items: [] },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Self-Hosting Reference',
|
||||
items: [
|
||||
{
|
||||
name: 'Auth Server',
|
||||
url: '/reference/self-hosting-auth/introduction',
|
||||
icon: '/img/icons/menu/reference-auth',
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
name: 'Storage Server',
|
||||
url: '/reference/self-hosting-storage/introduction',
|
||||
icon: '/img/icons/menu/reference-storage',
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
name: 'Realtime Server',
|
||||
url: '/reference/self-hosting-realtime/introduction',
|
||||
icon: '/img/icons/menu/reference-realtime',
|
||||
url: '/guides/resources/supabase-cli/managing-environments',
|
||||
items: [],
|
||||
},
|
||||
],
|
||||
@@ -581,12 +573,34 @@ export const resources = {
|
||||
],
|
||||
}
|
||||
|
||||
export const selfHosting = {
|
||||
label: 'Self-Hosting',
|
||||
export const self_hosting = {
|
||||
title: 'Self-Hosting',
|
||||
icon: 'resources',
|
||||
url: '/guides/self-hosting',
|
||||
items: [
|
||||
{ name: 'Overview', url: '/guides/hosting/overview', items: [] },
|
||||
{ name: 'Docker', url: '/guides/hosting/docker', items: [] },
|
||||
{ name: 'Overview', url: '/guides/self-hosting', items: [] },
|
||||
{ name: 'Self-Hosting with Docker', url: '/guides/self-hosting/docker', items: [] },
|
||||
{
|
||||
name: 'Auth Server',
|
||||
items: [
|
||||
{ name: 'Reference', url: '/reference/self-hosting-auth/introduction', items: [] },
|
||||
{ name: 'Configuration', url: '/guides/self-hosting/auth/config', items: [] },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Storage Server',
|
||||
items: [
|
||||
{ name: 'Reference', url: '/reference/self-hosting-storage/introduction', items: [] },
|
||||
{ name: 'Configuration', url: '/guides/self-hosting/storage/config', items: [] },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Realtime Server',
|
||||
items: [
|
||||
{ name: 'Reference', url: '/reference/self-hosting-realtime/introduction', items: [] },
|
||||
{ name: 'Configuration', url: '/guides/self-hosting/realtime/config', items: [] },
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -654,6 +668,11 @@ export const integrations = {
|
||||
{ name: 'Plasmic', url: '/guides/integrations/plasmic', items: [] },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Messaging',
|
||||
url: undefined,
|
||||
items: [{ name: 'OneSignal', url: '/guides/integrations/onesignal', items: [] }],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@@ -104,6 +104,9 @@ const SideNav = () => {
|
||||
case url.includes(`/docs/guides/resources`) && url:
|
||||
menuState.setMenuLevelId('resources')
|
||||
break
|
||||
case url.includes(`/docs/guides/self-hosting`) && url:
|
||||
menuState.setMenuLevelId('self_hosting')
|
||||
break
|
||||
case url.includes(`/docs/guides/integrations`) && url:
|
||||
menuState.setMenuLevelId('integrations')
|
||||
break
|
||||
|
||||
@@ -2,19 +2,7 @@ import Image from 'next/image'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import { FC, useEffect, useState } from 'react'
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Dropdown,
|
||||
IconCommand,
|
||||
IconMenu,
|
||||
IconMessageSquare,
|
||||
IconMoon,
|
||||
IconSearch,
|
||||
IconSun,
|
||||
Input,
|
||||
Listbox,
|
||||
} from 'ui'
|
||||
import { Button, IconCommand, IconGitHub, IconMoon, IconSearch, IconSun } from 'ui'
|
||||
import { SearchButton } from '~/components/DocSearch'
|
||||
import { REFERENCES } from '~/components/Navigation/Navigation.constants'
|
||||
import { useTheme } from 'common/Providers'
|
||||
@@ -134,7 +122,7 @@ const TopNavBarRef: FC = () => {
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
Main site
|
||||
Supabase.com
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
@@ -146,6 +134,18 @@ const TopNavBarRef: FC = () => {
|
||||
>
|
||||
Dashboard
|
||||
</Button>
|
||||
<ul className="flex items-center">
|
||||
<Button
|
||||
type="text"
|
||||
as="a"
|
||||
// @ts-ignore
|
||||
href="https://github.com/supabase/supabase"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
<IconGitHub size={16} />
|
||||
</Button>
|
||||
</ul>
|
||||
<ul className="flex items-center">
|
||||
<li className="px-4">
|
||||
<div className="cursor-pointer" onClick={toggleDarkMode}>
|
||||
|
||||
@@ -24,6 +24,13 @@ import RefSubLayout from '~/layouts/ref/RefSubLayout'
|
||||
// import { CH } from '@code-hike/mdx/components'
|
||||
import RefHeaderSection from './reference/RefHeaderSection'
|
||||
|
||||
// Ref version specific
|
||||
import CliGlobalFlagsHandler from '~/components/reference/enrichments/cli/CliGlobalFlagsHandler'
|
||||
|
||||
import Options from '~/components/Options'
|
||||
import Param from '~/components/Params'
|
||||
import Image from 'next/image'
|
||||
|
||||
const components = {
|
||||
Admonition,
|
||||
Button,
|
||||
@@ -64,6 +71,16 @@ const components = {
|
||||
// CH,
|
||||
code: (props: any) => <CodeBlock {...props} />,
|
||||
RefHeaderSection: (props: any) => <RefHeaderSection {...props} />,
|
||||
CliGlobalFlagsHandler: () => <CliGlobalFlagsHandler />,
|
||||
Options,
|
||||
Param,
|
||||
img: (props: any) => {
|
||||
return (
|
||||
<span className={['next-image--dynamic-fill'].join(' ')}>
|
||||
<Image {...props} className={['rounded-md border'].join(' ')} layout="fill" />
|
||||
</span>
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
export default components
|
||||
@@ -1,3 +1,4 @@
|
||||
import { IconChevronRight } from '~/../../packages/ui'
|
||||
// @ts-expect-error
|
||||
import spec from '~/../../spec/cli_v1_commands.yaml' assert { type: 'yml' }
|
||||
import CodeBlock from '~/components/CodeBlock/CodeBlock'
|
||||
@@ -26,6 +27,7 @@ export type Flag = {
|
||||
description: string
|
||||
default_value: string
|
||||
accepted_values: AcceptedValue[]
|
||||
required?: boolean
|
||||
}
|
||||
|
||||
export type AcceptedValue = {
|
||||
@@ -80,13 +82,19 @@ const CliCommandSection = (props) => {
|
||||
)} */}
|
||||
|
||||
{command.subcommands.length > 0 && (
|
||||
<div className="">
|
||||
<h3 className="text-sm text-scale-1200 mb-3">Available Commands</h3>
|
||||
<div className="mb-3">
|
||||
<h3 className="text-lg text-scale-1200 mb-3">Available Commands</h3>
|
||||
<ul>
|
||||
{command.subcommands.map((subcommand) => (
|
||||
<li key={subcommand}>
|
||||
<a href={`#${subcommand}`} className="text-scale-1200">
|
||||
<CodeBlock language="bash">{subcommand}</CodeBlock>
|
||||
<li key={subcommand} className="flex items-center gap-3">
|
||||
<div className="text-scale-900">
|
||||
<IconChevronRight size={14} strokeWidth={2} />
|
||||
</div>
|
||||
<a
|
||||
href={`#${subcommand}`}
|
||||
className="transition text-scale-1100 hover:text-brand-900"
|
||||
>
|
||||
$ {subcommand.replace(/-/g, ' ')}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
@@ -100,7 +108,7 @@ const CliCommandSection = (props) => {
|
||||
{command.flags.map((flag: Flag) => (
|
||||
<>
|
||||
<li className="mt-0">
|
||||
<Param {...flag}>
|
||||
<Param {...flag} isOptional={!flag.required}>
|
||||
{flag?.accepted_values && (
|
||||
<Options>
|
||||
{flag?.accepted_values.map((value) => {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { NextSeo } from 'next-seo'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
function RefSEO({ title }) {
|
||||
const router = useRouter()
|
||||
|
||||
const path = router.asPath.replace('crawlers/', '')
|
||||
|
||||
return (
|
||||
<NextSeo
|
||||
title={title}
|
||||
openGraph={{
|
||||
title,
|
||||
url: `https://supabase.com/docs${path}`,
|
||||
images: [
|
||||
{
|
||||
url: `https://supabase.com/docs/img/supabase-og-image.png`,
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default RefSEO
|
||||
@@ -5,7 +5,7 @@ import { useEffect } from 'react'
|
||||
import components from '~/components'
|
||||
import RefEducationSection from '~/components/reference/RefEducationSection'
|
||||
import RefFunctionSection from '~/components/reference/RefFunctionSection'
|
||||
import OldLayout from '~/layouts/Default'
|
||||
|
||||
import RefSubLayout from '~/layouts/ref/RefSubLayout'
|
||||
import ApiOperationSection from './ApiOperationSection'
|
||||
import CliCommandSection from './CLICommandSection'
|
||||
@@ -34,18 +34,6 @@ const RefSectionHandler = (props) => {
|
||||
}
|
||||
})
|
||||
|
||||
/*
|
||||
* handle old ref pages
|
||||
*/
|
||||
if (!isNewDocs) {
|
||||
return (
|
||||
// @ts-ignore
|
||||
<OldLayout meta={props.pageProps.meta} toc={props.pageProps.toc}>
|
||||
<MDXRemote {...props.pageProps.content} components={components} />
|
||||
</OldLayout>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<RefSubLayout>
|
||||
{props.sections.map((x) => {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import RefSubLayout from '~/layouts/ref/RefSubLayout'
|
||||
|
||||
// @ts-expect-error
|
||||
import spec from '~/../../spec/cli_v1_commands.yaml' assert { type: 'yaml' }
|
||||
import Param from '~/components/Params'
|
||||
import Options from '~/components/Options'
|
||||
|
||||
const CliGlobalFlagsHandler = () => {
|
||||
return (
|
||||
<RefSubLayout.EducationRow className="not-prose">
|
||||
<RefSubLayout.Details>
|
||||
<h3 className="text-lg text-scale-1200 mb-3">Flags</h3>
|
||||
<ul className="">
|
||||
{spec.flags.map((flag) => {
|
||||
return (
|
||||
<Param
|
||||
{...flag}
|
||||
isOptional={flag.required === undefined ? true : !flag.required}
|
||||
></Param>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</RefSubLayout.Details>
|
||||
|
||||
<RefSubLayout.Examples></RefSubLayout.Examples>
|
||||
</RefSubLayout.EducationRow>
|
||||
)
|
||||
}
|
||||
|
||||
export default CliGlobalFlagsHandler
|
||||
@@ -1,26 +1,8 @@
|
||||
const authProviders = [
|
||||
// {
|
||||
// name: 'Email',
|
||||
// // logo: '/img/libraries/dart-icon.svg',
|
||||
// href: '/docs/guides/auth/auth-apple',
|
||||
// official: true,
|
||||
// supporter: 'Supabase',
|
||||
// platform: true,
|
||||
// selfHosted: true,
|
||||
// },
|
||||
// {
|
||||
// name: 'Magic Links',
|
||||
// // logo: '/img/libraries/dart-icon.svg',
|
||||
// href: '/docs/guides/auth/auth-apple',
|
||||
// official: true,
|
||||
// supporter: 'Supabase',
|
||||
// platform: true,
|
||||
// selfHosted: true,
|
||||
// },
|
||||
{
|
||||
name: 'Apple',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-apple',
|
||||
href: '/guides/auth/social-login/auth-apple',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -29,7 +11,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'Azure',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-azure',
|
||||
href: '/guides/auth/social-login/auth-azure',
|
||||
official: false,
|
||||
supporter: 'TBD',
|
||||
platform: true,
|
||||
@@ -38,7 +20,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'Bitbucket',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-bitbucket',
|
||||
href: '/guides/auth/social-login/auth-bitbucket',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -47,7 +29,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'Discord',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-discord',
|
||||
href: '/guides/auth/social-login/auth-discord',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -56,7 +38,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'Facebook',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-facebook',
|
||||
href: '/guides/auth/social-login/auth-facebook',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -65,7 +47,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'GitHub',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-github',
|
||||
href: '/guides/auth/social-login/auth-github',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -74,7 +56,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'GitLab',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-gitlab',
|
||||
href: '/guides/auth/social-login/auth-gitlab',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -83,7 +65,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'Google',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-google',
|
||||
href: '/guides/auth/social-login/auth-google',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -91,7 +73,7 @@ const authProviders = [
|
||||
},
|
||||
{
|
||||
name: 'Keycloak',
|
||||
href: '/guides/auth/auth-keycloak',
|
||||
href: '/guides/auth/social-login/auth-keycloak',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -100,7 +82,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'LinkedIn',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-linkedin',
|
||||
href: '/guides/auth/social-login/auth-linkedin',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -109,7 +91,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'MessageBird',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-messagebird',
|
||||
href: '/guides/auth/phone-login/messagebird',
|
||||
official: false,
|
||||
supporter: 'MessageBird',
|
||||
platform: true,
|
||||
@@ -118,7 +100,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'Notion',
|
||||
// logo: '/img/libraries/notion-icon.svg',
|
||||
href: '/guides/auth/auth-notion',
|
||||
href: '/guides/auth/social-login/auth-notion',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -127,7 +109,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'Slack',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-slack',
|
||||
href: '/guides/auth/social-login/auth-slack',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -136,7 +118,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'Spotify',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-spotify',
|
||||
href: '/guides/auth/social-login/auth-spotify',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -145,7 +127,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'Twitter',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-twitter',
|
||||
href: '/guides/auth/social-login/auth-twitter',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -154,7 +136,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'Twitch',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-twitch',
|
||||
href: '/guides/auth/social-login/auth-twitch',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -163,7 +145,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'Zoom',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-zoom',
|
||||
href: '/guides/auth/social-login/auth-zoom',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -172,7 +154,7 @@ const authProviders = [
|
||||
{
|
||||
name: 'Twilio',
|
||||
// logo: '/img/libraries/dart-icon.svg',
|
||||
href: '/guides/auth/auth-twilio',
|
||||
href: '/guides/auth/phone-login/twilio',
|
||||
official: true,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
@@ -180,7 +162,7 @@ const authProviders = [
|
||||
},
|
||||
{
|
||||
name: 'Vonage',
|
||||
href: '/guides/auth/auth-vonage',
|
||||
href: '/guides/auth/phone-login/vonage',
|
||||
official: false,
|
||||
supporter: 'Supabase',
|
||||
platform: true,
|
||||
|
||||
+6
-146
@@ -1,150 +1,10 @@
|
||||
[
|
||||
{ "title": "Contributing", "url": "/handbook/contributing" },
|
||||
{ "title": "Changelog", "url": "https://supabase.com/changelog" },
|
||||
{
|
||||
"title": "Product",
|
||||
"links": [
|
||||
{
|
||||
"text": "Database",
|
||||
"url": "/database"
|
||||
},
|
||||
{
|
||||
"text": "Auth",
|
||||
"url": "/auth"
|
||||
},
|
||||
{
|
||||
"text": "Functions",
|
||||
"url": "/edge-functions"
|
||||
},
|
||||
{
|
||||
"text": "Realtime",
|
||||
"url": "/realtime"
|
||||
},
|
||||
{
|
||||
"text": "Storage",
|
||||
"url": "/storage"
|
||||
},
|
||||
{
|
||||
"text": "Pricing",
|
||||
"url": "/pricing"
|
||||
},
|
||||
{
|
||||
"text": "Beta",
|
||||
"url": "/beta"
|
||||
}
|
||||
]
|
||||
"title": "Author Styleguide",
|
||||
"url": "https://github.com/supabase/supabase/blob/master/DEVELOPERS.md"
|
||||
},
|
||||
{
|
||||
"title": "Resources",
|
||||
"links": [
|
||||
{
|
||||
"text": "Support",
|
||||
"url": "/support"
|
||||
},
|
||||
{
|
||||
"text": "System Status",
|
||||
"url": "https://status.supabase.com/"
|
||||
},
|
||||
{
|
||||
"text": "Integrations",
|
||||
"url": "/partners/integrations"
|
||||
},
|
||||
{
|
||||
"text": "Experts",
|
||||
"url": "/partners/experts"
|
||||
},
|
||||
{
|
||||
"text": "Brand Assets / Logos",
|
||||
"url": "/brand-assets"
|
||||
},
|
||||
{
|
||||
"text": "DPA",
|
||||
"url": "/legal/dpa"
|
||||
},
|
||||
{
|
||||
"text": "SOC2",
|
||||
"url": "/legal/soc2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Developers",
|
||||
"links": [
|
||||
{
|
||||
"text": "Documentation",
|
||||
"url": "/docs"
|
||||
},
|
||||
{
|
||||
"text": "API Reference",
|
||||
"url": "/docs/reference"
|
||||
},
|
||||
{
|
||||
"text": "Changelog",
|
||||
"url": "/changelog"
|
||||
},
|
||||
{
|
||||
"text": "Contributing",
|
||||
"url": "/docs/handbook/contributing"
|
||||
},
|
||||
{
|
||||
"text": "Open Source",
|
||||
"url": "/docs/oss"
|
||||
},
|
||||
{
|
||||
"text": "SupaSquad",
|
||||
"url": "/docs/handbook/supasquad"
|
||||
},
|
||||
{
|
||||
"text": "DevTo",
|
||||
"url": "https://dev.to/supabase"
|
||||
},
|
||||
{
|
||||
"text": "RSS",
|
||||
"url": "/rss.xml"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Company",
|
||||
"links": [
|
||||
{
|
||||
"text": "Blog",
|
||||
"url": "/blog"
|
||||
},
|
||||
{
|
||||
"text": "Careers",
|
||||
"url": "https://about.supabase.com/careers"
|
||||
},
|
||||
{
|
||||
"text": "Company",
|
||||
"url": "/company"
|
||||
},
|
||||
{
|
||||
"text": "Terms of Service",
|
||||
"url": "/docs/company/terms"
|
||||
},
|
||||
{
|
||||
"text": "Privacy Policy",
|
||||
"url": "/docs/company/privacy"
|
||||
},
|
||||
{
|
||||
"text": "Acceptable Use Policy",
|
||||
"url": "/docs/company/aup"
|
||||
},
|
||||
{
|
||||
"text": "Service Level Agreement",
|
||||
"url": "/docs/company/sla"
|
||||
},
|
||||
{
|
||||
"text": "Humans.txt",
|
||||
"url": "/humans.txt"
|
||||
},
|
||||
{
|
||||
"text": "Lawyers.txt",
|
||||
"url": "/lawyers.txt"
|
||||
},
|
||||
{
|
||||
"text": "Security.txt",
|
||||
"url": "/.well-known/security.txt"
|
||||
}
|
||||
]
|
||||
}
|
||||
{ "title": "Open Source", "url": "https://supabase.com/docs/oss" },
|
||||
{ "title": "SupaSquad", "url": "https://supabase.com/supasquad" }
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
title: Global Flags
|
||||
description: 'Supabase CLI supports global flags for every command.'
|
||||
---
|
||||
|
||||
Supabase CLI supports global flags for every command.
|
||||
|
||||
<CliGlobalFlagsHandler />
|
||||
@@ -0,0 +1,13 @@
|
||||
import sections from '../../../../spec/common-api-sections.json' assert { type: 'json' }
|
||||
import { flattenSections } from '../helpers.mjs'
|
||||
|
||||
const flatSections = flattenSections(sections)
|
||||
|
||||
export function generateAPIPages() {
|
||||
let apiPages = []
|
||||
|
||||
flatSections.map((section) => {
|
||||
apiPages.push(`reference/api/${section.slug}`)
|
||||
})
|
||||
return apiPages
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import fs from 'fs'
|
||||
import yaml from 'js-yaml'
|
||||
import cliCommonSections from '../../../../spec/common-cli-sections.json' assert { type: 'json' }
|
||||
import { flattenSections } from '../helpers.mjs'
|
||||
|
||||
const flatCLISections = flattenSections(cliCommonSections)
|
||||
|
||||
const cliSpec = yaml.load(fs.readFileSync(`../../spec/cli_v1_commands.yaml`, 'utf8'))
|
||||
|
||||
export function generateCLIPages() {
|
||||
let cliPages = []
|
||||
|
||||
cliSpec.commands.map((section) => {
|
||||
const slug = flatCLISections.find((item) => item.id === section.id)?.slug
|
||||
if (slug) cliPages.push(`reference/cli/${slug}`)
|
||||
})
|
||||
return cliPages
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import fs from 'fs'
|
||||
|
||||
import yaml from 'js-yaml'
|
||||
import commonLibSections from '../../../../spec/common-client-libs-sections.json' assert { type: 'json' }
|
||||
import { flattenSections } from '../helpers.mjs'
|
||||
|
||||
const flatCommonLibSections = flattenSections(commonLibSections)
|
||||
|
||||
const clientLibFiles = [
|
||||
{ fileName: 'supabase_js_v2', label: 'javascript', version: 'v2', versionSlug: false },
|
||||
{ fileName: 'supabase_js_v1', label: 'javascript', version: 'v1', versionSlug: true },
|
||||
{ fileName: 'supabase_dart_v1', label: 'dart', version: 'v1', versionSlug: false },
|
||||
{ fileName: 'supabase_dart_v0', label: 'dart', version: 'v0', versionSlug: true },
|
||||
{ fileName: 'supabase_dart_v0', label: 'dart', version: 'v0', versionSlug: true },
|
||||
]
|
||||
|
||||
export function generateReferencePages() {
|
||||
let refPages = []
|
||||
clientLibFiles.map((file) => {
|
||||
const spec = yaml.load(fs.readFileSync(`../../spec/${file.fileName}.yml`, 'utf8'))
|
||||
spec.functions.map((fn) => {
|
||||
const slug = flatCommonLibSections.find((item) => item.id === fn.id)?.slug
|
||||
refPages.push(`reference/${file.label}/${file.versionSlug ? file.version + '/' : ''}${slug}`)
|
||||
})
|
||||
})
|
||||
return refPages
|
||||
}
|
||||
@@ -1,65 +1,49 @@
|
||||
import { writeFileSync } from 'fs'
|
||||
import { globby } from 'globby'
|
||||
import prettier from 'prettier'
|
||||
|
||||
/*
|
||||
* kudos to leerob from vercel
|
||||
* https://leerob.io/blog/nextjs-sitemap-robots
|
||||
*/
|
||||
|
||||
import { writeFileSync } from 'fs'
|
||||
import { globby } from 'globby'
|
||||
import prettier from 'prettier'
|
||||
import { generateCLIPages } from './files/cli.mjs'
|
||||
import { generateReferencePages } from './files/reference-lib.mjs'
|
||||
import { generateAPIPages } from './files/api.mjs'
|
||||
|
||||
const referencePages = generateReferencePages()
|
||||
const cliPages = generateCLIPages()
|
||||
const apiPages = generateAPIPages()
|
||||
|
||||
async function generate() {
|
||||
const prettierConfig = await prettier.resolveConfig('./.prettierrc.js')
|
||||
|
||||
const rawPages = await globby([
|
||||
// guides
|
||||
'docs/*.mdx',
|
||||
'!docs/404.mdx',
|
||||
'pages/**/*.mdx',
|
||||
// reference
|
||||
'docs/reference/*.mdx',
|
||||
'docs/reference/javascript/*.mdx',
|
||||
'docs/reference/javascript/generated/*.mdx',
|
||||
'!docs/reference/javascript/v1.mdx', // ignore this
|
||||
'docs/reference/dart/*.mdx',
|
||||
'docs/reference/dart/generated/*.mdx',
|
||||
'!docs/reference/dart/v0.mdx', // ignore this
|
||||
'docs/reference/api/*.mdx',
|
||||
'docs/reference/api/generated/*.mdx',
|
||||
'docs/reference/cli/*.mdx',
|
||||
'docs/reference/cli/generated/*.mdx',
|
||||
// misc reference
|
||||
'docs/reference/postgres/*.mdx',
|
||||
'docs/reference/postgres/generated/*.mdx',
|
||||
'docs/reference/realtime/*.mdx',
|
||||
'docs/reference/realtime/generated/*.mdx',
|
||||
'docs/reference/storage/*.mdx',
|
||||
'docs/reference/storage/generated/*.mdx',
|
||||
'docs/reference/auth/*.mdx',
|
||||
'docs/reference/auth/generated/*.mdx',
|
||||
'!pages/404.mdx',
|
||||
'!pages/404.tsx',
|
||||
'!pages/ref-pages.mdx',
|
||||
])
|
||||
|
||||
const pages = rawPages.map((x) => {
|
||||
const guidePages = rawPages.map((x) => {
|
||||
let string = x
|
||||
string = string.replace('/generated', '')
|
||||
string = string.replace('pages/', '')
|
||||
string = string.replace('.mdx', '')
|
||||
return string
|
||||
})
|
||||
|
||||
// add static OSS page
|
||||
pages.unshift('docs/oss')
|
||||
// add static homepage
|
||||
pages.unshift('docs')
|
||||
// combine the guidePages with the ref pages
|
||||
const allPages = guidePages.concat(referencePages, cliPages, apiPages)
|
||||
|
||||
const sitemap = `
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
${pages
|
||||
${allPages
|
||||
.map((path) => {
|
||||
// fix homepage
|
||||
path = path.replace('pages/index', '')
|
||||
return `
|
||||
<url>
|
||||
<loc>${`https://supabase.com/${path.replace('pages/', 'docs/')}`}</loc>
|
||||
<loc>${`https://supabase.com/docs/${path}`}</loc>
|
||||
<changefreq>weekly</changefreq>
|
||||
<changefreq>0.5</changefreq>
|
||||
</url>
|
||||
@@ -75,7 +59,9 @@ async function generate() {
|
||||
})
|
||||
|
||||
const sitemapFilePath = `public/sitemap.xml`
|
||||
console.log(`Total of ${pages.length} pages in sitemap, located at /apps/docs/${sitemapFilePath}`)
|
||||
console.log(
|
||||
`Total of ${allPages.length} pages in sitemap, located at /apps/docs/${sitemapFilePath}`
|
||||
)
|
||||
|
||||
// eslint-disable-next-line no-sync
|
||||
writeFileSync(sitemapFilePath, formatted)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
export function flattenSections(sections) {
|
||||
var a = []
|
||||
for (var i = 0; i < sections.length; i++) {
|
||||
if (sections[i].id) {
|
||||
// only push a section that has an id
|
||||
// these are reserved for sidebar subtitles
|
||||
a.push(sections[i])
|
||||
}
|
||||
if (sections[i].items) {
|
||||
// if there are subitems, loop through
|
||||
a = a.concat(flattenSections(sections[i].items))
|
||||
}
|
||||
}
|
||||
return a
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// generator files need their own tsconfig.json because they don't like "module": "esnext" setting that nextjs requires in the main tsconfig
|
||||
{
|
||||
"compilerOptions": {
|
||||
"incremental": true,
|
||||
"noImplicitAny": false,
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"~/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
import { useEffect, FC } from 'react'
|
||||
import { NextSeo } from 'next-seo'
|
||||
import NavBar from '../components/Navigation/NavBar'
|
||||
import SideBar from '../components/Navigation/SideBar'
|
||||
import Footer from '../components/Footer'
|
||||
import TableOfContents from '~/components/TableOfContents'
|
||||
import { menuItems } from '~/components/Navigation/Navigation.constants'
|
||||
import { useRouter } from 'next/router'
|
||||
import { getPageType } from '~/lib/helpers'
|
||||
|
||||
interface Props {
|
||||
meta: { title: string; description?: string; hide_table_of_contents?: boolean }
|
||||
children: any
|
||||
toc?: any
|
||||
menuItems?: any
|
||||
currentPage?: string
|
||||
}
|
||||
|
||||
const Layout: FC<Props> = ({ meta, children, toc }) => {
|
||||
const { asPath } = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
const key = localStorage.getItem('supabaseDarkMode')
|
||||
if (!key) {
|
||||
// Default to dark mode if no preference config
|
||||
document.documentElement.className = 'dark'
|
||||
} else {
|
||||
document.documentElement.className = key === 'true' ? 'dark' : ''
|
||||
}
|
||||
}, [])
|
||||
|
||||
const hasTableOfContents =
|
||||
toc !== undefined && toc.json.filter((item) => item.lvl !== 1 && item.lvl <= 3).length > 0
|
||||
|
||||
const pageType = getPageType(asPath)
|
||||
|
||||
console.log('Default, pageType', pageType)
|
||||
|
||||
return (
|
||||
<>
|
||||
<NextSeo
|
||||
title={`${meta?.title} | Supabase`}
|
||||
description={meta?.description ? meta?.description : meta?.title}
|
||||
openGraph={{
|
||||
title: meta?.title,
|
||||
description: meta?.description,
|
||||
url: `https://supabase.com/docs/${asPath}`,
|
||||
images: [
|
||||
{
|
||||
url: `https://supabase.com/docs/img/supabase-og-image.png`,
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>
|
||||
|
||||
<main>
|
||||
<NavBar />
|
||||
<div className="flex w-full flex-row">
|
||||
<SideBar menuItems={menuItems[pageType]} />
|
||||
<div className="main-content-pane docs-width grid md:grid-cols-12 gap-4 justify-between p-4 pb-8 w-full">
|
||||
<div
|
||||
className={`${
|
||||
meta?.hide_table_of_contents || !hasTableOfContents
|
||||
? 'col-span-12 xl:col-start-2 xl:col-span-10 2xl:col-start-3 2xl:col-span-8'
|
||||
: 'col-span-12 lg:col-span-9'
|
||||
} py-2 lg:py-4 px-2 lg:px-8 mx-auto`}
|
||||
>
|
||||
<article
|
||||
className={`${
|
||||
meta?.hide_table_of_contents || !hasTableOfContents ? 'xl:min-w-[880px]' : ''
|
||||
} doc-content-container prose dark:prose-dark dark:bg-scale-200 width-full mt-8 2xl:max-w-[880px]`}
|
||||
>
|
||||
{children}
|
||||
</article>
|
||||
</div>
|
||||
{hasTableOfContents && !meta?.hide_table_of_contents && (
|
||||
<div
|
||||
className={[
|
||||
'border-scale-400 dark:bg-scale-200 table-of-contents-height border-l',
|
||||
'thin-scrollbar overflow-y-auto sticky hidden xl:block md:col-span-3 px-2',
|
||||
].join(' ')}
|
||||
>
|
||||
<TableOfContents toc={toc} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<Footer />
|
||||
</main>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default Layout
|
||||
@@ -13,8 +13,9 @@ import {
|
||||
// useMenuMobileOpen
|
||||
} from '~/hooks/useMenuState'
|
||||
import { useEffect } from 'react'
|
||||
import Footer from '~/components/Navigation/Footer'
|
||||
|
||||
const SiteRefLayout = ({ children }) => {
|
||||
const SiteLayout = ({ children }) => {
|
||||
const { isDarkMode } = useTheme()
|
||||
|
||||
useEffect(() => {
|
||||
@@ -69,6 +70,10 @@ const SiteRefLayout = ({ children }) => {
|
||||
icon: '/docs/img/icons/menu/resources',
|
||||
name: 'Resources',
|
||||
},
|
||||
self_hosting: {
|
||||
icon: '/docs/img/icons/menu/self-hosting',
|
||||
name: 'Self-Hosting',
|
||||
},
|
||||
integrations: {
|
||||
icon: '/docs/img/icons/menu/integrations',
|
||||
name: 'Integrations',
|
||||
@@ -276,31 +281,8 @@ const SiteRefLayout = ({ children }) => {
|
||||
</div>
|
||||
<div className="grow px-5 max-w-7xl mx-auto py-16">
|
||||
{children}
|
||||
|
||||
<div className="mt-32">
|
||||
<FooterHelpCallout />
|
||||
</div>
|
||||
<hr className="border-scale-400 mt-8"></hr>
|
||||
<div className="flex flex-col lg:flex-row gap-3 mt-6">
|
||||
<span className="text-xs text-scale-900">Supabase 2022</span>
|
||||
<span className="text-xs text-scale-900">—</span>
|
||||
<Link href="/handbook/contributing">
|
||||
<a className="text-xs text-scale-800 hover:underline">Contributing</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/changelog">
|
||||
<a className="text-xs text-scale-800 hover:underline">Changelog</a>
|
||||
</Link>
|
||||
|
||||
<Link href="https://github.com/supabase/supabase/blob/master/DEVELOPERS.md">
|
||||
<a className="text-xs text-scale-800 hover:underline">Author Styleguide</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/docs/oss">
|
||||
<a className="text-xs text-scale-800 hover:underline">Open Source</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/docs/handbook/supasquad">
|
||||
<a className="text-xs text-scale-800 hover:underline">Supasquad</a>
|
||||
</Link>
|
||||
</div>
|
||||
<FooterHelpCallout />
|
||||
<Footer />
|
||||
</div>
|
||||
|
||||
<div
|
||||
@@ -323,4 +305,4 @@ const SiteRefLayout = ({ children }) => {
|
||||
)
|
||||
}
|
||||
|
||||
export default SiteRefLayout
|
||||
export default SiteLayout
|
||||
@@ -1,321 +0,0 @@
|
||||
import { useTheme } from 'common/Providers'
|
||||
import Image from 'next/image'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import NavigationMenu from '~/components/Navigation/NavigationMenu/NavigationMenu'
|
||||
import TopNavBarRef from '~/components/Navigation/NavigationMenu/TopNavBarRef'
|
||||
|
||||
import FooterHelpCallout from '~/components/FooterHelpCallout'
|
||||
|
||||
import { menuState } from '~/hooks/useMenuState'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
const SiteRefLayout = ({ children }) => {
|
||||
const { isDarkMode } = useTheme()
|
||||
|
||||
useEffect(() => {
|
||||
const key = localStorage.getItem('supabaseDarkMode')
|
||||
if (!key) {
|
||||
// Default to dark mode if no preference config
|
||||
document.documentElement.className = 'dark'
|
||||
} else {
|
||||
document.documentElement.className = key === 'true' ? 'dark' : ''
|
||||
}
|
||||
}, [])
|
||||
|
||||
const menuLevel = 'home'
|
||||
// useMenuLevelId()
|
||||
const mobileMenuOpen = false
|
||||
|
||||
const levelsData = {
|
||||
home: {
|
||||
icon: '/docs/img/icons/menu/home',
|
||||
name: 'Home',
|
||||
},
|
||||
gettingstarted: {
|
||||
icon: '/docs/img/icons/menu/getting-started',
|
||||
name: 'Getting Started',
|
||||
},
|
||||
database: {
|
||||
icon: '/docs/img/icons/menu/database',
|
||||
name: 'Database',
|
||||
},
|
||||
auth: {
|
||||
icon: '/docs/img/icons/menu/auth',
|
||||
name: 'Auth',
|
||||
},
|
||||
functions: {
|
||||
icon: '/docs/img/icons/menu/functions',
|
||||
name: 'Functions',
|
||||
},
|
||||
realtime: {
|
||||
icon: '/docs/img/icons/menu/realtime',
|
||||
name: 'Realtime',
|
||||
},
|
||||
storage: {
|
||||
icon: '/docs/img/icons/menu/storage',
|
||||
name: 'Storage',
|
||||
},
|
||||
platform: {
|
||||
icon: '/docs/img/icons/menu/platform',
|
||||
name: 'Platform',
|
||||
},
|
||||
resources: {
|
||||
icon: '/docs/img/icons/menu/resources',
|
||||
name: 'Resources',
|
||||
},
|
||||
integrations: {
|
||||
icon: '/docs/img/icons/menu/integrations',
|
||||
name: 'Integrations',
|
||||
},
|
||||
reference_javascript_v1: {
|
||||
icon: '/docs/img/icons/menu/reference-javascript',
|
||||
name: 'Javascript Reference v1.0',
|
||||
},
|
||||
reference_javascript_v2: {
|
||||
icon: '/docs/img/icons/menu/reference-javascript',
|
||||
name: 'Javascript Reference v2.0',
|
||||
},
|
||||
reference_dart_v0: {
|
||||
icon: '/docs/img/icons/menu/reference-dart',
|
||||
name: 'Dart Reference v0.0',
|
||||
},
|
||||
reference_dart_v1: {
|
||||
icon: '/docs/img/icons/menu/reference-dart',
|
||||
name: 'Dart Reference v0.0',
|
||||
},
|
||||
reference_cli: {
|
||||
icon: '/docs/img/icons/menu/reference-cli',
|
||||
name: 'CLI Reference',
|
||||
},
|
||||
reference_api: {
|
||||
icon: '/docs/img/icons/menu/reference-api',
|
||||
name: 'Management API Reference',
|
||||
},
|
||||
reference_self_hosting_auth: {
|
||||
icon: '/docs/img/icons/menu/reference-auth',
|
||||
name: 'Auth Server Reference',
|
||||
},
|
||||
reference_self_hosting_storage: {
|
||||
icon: '/docs/img/icons/menu/reference-storage',
|
||||
name: 'Storage Server Reference',
|
||||
},
|
||||
reference_self_hosting_realtime: {
|
||||
icon: '/docs/img/icons/menu/reference-realtime',
|
||||
name: 'Realtime Server Reference',
|
||||
},
|
||||
}
|
||||
|
||||
return (
|
||||
<main>
|
||||
{/* <img
|
||||
src={`${router.basePath}/img/gradient-bg.png`}
|
||||
className="absolute left-0 w-[520px] top-0 -z-1 pointer-events-none"
|
||||
/> */}
|
||||
|
||||
<div className="flex flex-row h-screen">
|
||||
<div
|
||||
className={[
|
||||
'hidden', // experiment hidden
|
||||
'transition-all',
|
||||
'top-0',
|
||||
'relative',
|
||||
'h-screen w-[420px]',
|
||||
'z-10',
|
||||
'lg:flex flex-col ml-0',
|
||||
].join(' ')}
|
||||
>
|
||||
<div
|
||||
className={[
|
||||
'top-0',
|
||||
'relative',
|
||||
'w-auto',
|
||||
'z-10',
|
||||
|
||||
'border-r overflow-auto h-screen',
|
||||
'backdrop-blur backdrop-filter bg-white-1200 dark:bg-blackA-300',
|
||||
'flex flex-col',
|
||||
].join(' ')}
|
||||
>
|
||||
<div className="top-0 sticky z-10">
|
||||
<div>
|
||||
<div>
|
||||
<div
|
||||
className={[
|
||||
'hidden md:flex md:height-auto',
|
||||
'pt-8 bg-scale-200 flex-col gap-8',
|
||||
].join(' ')}
|
||||
>
|
||||
<Link href="/">
|
||||
<a className="px-10 flex items-center gap-2">
|
||||
<Image
|
||||
className="cursor-pointer"
|
||||
src={isDarkMode ? '/docs/supabase-dark.svg' : '/docs/supabase-light.svg'}
|
||||
width={96}
|
||||
height={24}
|
||||
alt="Supabase Logo"
|
||||
/>
|
||||
<span className="font-mono text-sm font-medium text-brand-900">DOCS</span>
|
||||
</a>
|
||||
</Link>
|
||||
{/* {router.asPath.includes('/reference/') && <RefSwitcher />} */}
|
||||
</div>
|
||||
<div className="h-4 bg-scale-200 w-full"></div>
|
||||
<div className="bg-gradient-to-b from-scale-200 to-transparent h-4 w-full"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={['pb-10 px-5 md:px-10 md:flex'].join(' ')}>
|
||||
<NavigationMenu />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
// #docs-content-container is used by layout to scroll to top
|
||||
id="docs-content-container"
|
||||
className={[
|
||||
'w-full h-screen transition-all ease-out',
|
||||
mobileMenuOpen ? 'overflow-hidden' : 'overflow-auto',
|
||||
].join(' ')}
|
||||
>
|
||||
<div className="flex flex-col relative">
|
||||
{/* <NavigationMenu /> */}
|
||||
<div className={['lg:sticky top-0 z-10 overflow-hidden'].join(' ')}>
|
||||
<TopNavBarRef />
|
||||
</div>
|
||||
<div
|
||||
className={[
|
||||
'sticky transition-all top-0',
|
||||
'z-10',
|
||||
'backdrop-blur backdrop-filter bg-white-1200 dark:bg-blackA-300',
|
||||
].join(' ')}
|
||||
>
|
||||
<div className={['lg:hidden', 'px-5 ', 'border-b z-10'].join(' ')}>
|
||||
<div
|
||||
className={[
|
||||
'transition-all ease-out z-10',
|
||||
'top-0',
|
||||
mobileMenuOpen && 'absolute',
|
||||
'flex items-center h-[40px]',
|
||||
mobileMenuOpen ? 'gap-0' : 'gap-3',
|
||||
].join(' ')}
|
||||
>
|
||||
<button
|
||||
className={['mr-2', mobileMenuOpen && 'mt-0.5'].join(' ')}
|
||||
onClick={() => menuState.setMenuMobileOpen(!mobileMenuOpen)}
|
||||
>
|
||||
<div
|
||||
className={[
|
||||
'space-y-1 group cursor-pointer relative',
|
||||
mobileMenuOpen ? 'w-4 h-4' : 'w-4 h-[8px]',
|
||||
].join(' ')}
|
||||
>
|
||||
<span
|
||||
className={[
|
||||
'transition-all ease-out block w-4 h-px bg-scale-900 group-hover:bg-scale-1200',
|
||||
!mobileMenuOpen ? 'w-4' : 'absolute rotate-45 top-[6px]',
|
||||
].join(' ')}
|
||||
></span>
|
||||
<span
|
||||
className={[
|
||||
'transition-all ease-out block h-px bg-scale-900 group-hover:bg-scale-1200',
|
||||
!mobileMenuOpen
|
||||
? 'w-3 group-hover:w-4'
|
||||
: 'absolute w-4 -rotate-45 top-[2px]',
|
||||
].join(' ')}
|
||||
></span>
|
||||
</div>
|
||||
</button>
|
||||
<div className={[].join(' ')}>
|
||||
<img
|
||||
src={
|
||||
menuLevel
|
||||
? levelsData[menuLevel].icon + '.svg'
|
||||
: levelsData['home'].icon + '.svg'
|
||||
}
|
||||
className={[
|
||||
'transition-all duration-200',
|
||||
mobileMenuOpen ? 'invisible w-0 h-0' : 'w-4 h-4',
|
||||
].join(' ')}
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
className={[
|
||||
'transition-all duration-200',
|
||||
'text-scale-1200',
|
||||
mobileMenuOpen ? 'text-xs' : 'text-sm',
|
||||
].join(' ')}
|
||||
>
|
||||
{mobileMenuOpen
|
||||
? 'Close'
|
||||
: menuLevel
|
||||
? levelsData[menuLevel].name
|
||||
: levelsData['home'].name}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
className={[
|
||||
'transition-all ease-out duration-200',
|
||||
'absolute left-0 right-0 h-screen',
|
||||
'px-5 pl-5 py-16',
|
||||
'top-[0px]',
|
||||
'bg-scale-200',
|
||||
mobileMenuOpen
|
||||
? 'overflow-y-auto opacity-100 left-[0px] visible'
|
||||
: 'left-[-40px] h-0 opacity-0 invisible',
|
||||
].join(' ')}
|
||||
>
|
||||
<NavigationMenu />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grow px-5 max-w-7xl mx-auto py-16">
|
||||
{children}
|
||||
|
||||
<div className="mt-32">
|
||||
<FooterHelpCallout />
|
||||
</div>
|
||||
<hr className="border-scale-400 mt-8"></hr>
|
||||
<div className="flex flex-col lg:flex-row gap-3 mt-6">
|
||||
<span className="text-xs text-scale-900">Supabase 2022</span>
|
||||
<span className="text-xs text-scale-900">—</span>
|
||||
<Link href="/handbook/contributing">
|
||||
<a className="text-xs text-scale-800 hover:underline">Contributing</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/changelog">
|
||||
<a className="text-xs text-scale-800 hover:underline">Changelog</a>
|
||||
</Link>
|
||||
|
||||
<Link href="https://github.com/supabase/supabase/blob/master/DEVELOPERS.md">
|
||||
<a className="text-xs text-scale-800 hover:underline">Author Styleguide</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/docs/oss">
|
||||
<a className="text-xs text-scale-800 hover:underline">Open Source</a>
|
||||
</Link>
|
||||
<Link href="https://supabase.com/docs/handbook/supasquad">
|
||||
<a className="text-xs text-scale-800 hover:underline">Supasquad</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={[
|
||||
// 'top-0 left-0',
|
||||
'hidden', // experiment hidden
|
||||
'h-full',
|
||||
'left-0',
|
||||
'right-0',
|
||||
'z-10',
|
||||
'backdrop-blur-sm backdrop-filter bg-white-1200 dark:bg-blackA-600',
|
||||
mobileMenuOpen ? 'absolute MOBILE-MENU-OPEN' : 'hidden h-0 MOBILE-MENU-CLOSED',
|
||||
].join(' ')}
|
||||
onClick={() => menuState.setMenuMobileOpen(!mobileMenuOpen)}
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
export default SiteRefLayout
|
||||
@@ -1,7 +1,9 @@
|
||||
import { MDXProvider } from '@mdx-js/react'
|
||||
import { NextSeo } from 'next-seo'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import { FC, useEffect, useRef, useState } from 'react'
|
||||
import { IconExternalLink } from 'ui'
|
||||
import components from '~/components'
|
||||
import { highlightSelectedTocItem } from '~/components/CustomHTMLElements/CustomHTMLElements.utils'
|
||||
import GuidesTableOfContents from '~/components/GuidesTableOfContents'
|
||||
@@ -31,6 +33,8 @@ const Layout: FC<Props> = (props) => {
|
||||
const { asPath } = useRouter()
|
||||
const page = getPageType(asPath)
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
if (hash && tocList.length > 0) {
|
||||
highlightSelectedTocItem(hash as string)
|
||||
@@ -72,7 +76,7 @@ const Layout: FC<Props> = (props) => {
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className={['grid grid-cols-12 relative'].join(' ')}>
|
||||
<div className={['grid grid-cols-12 relative gap-4'].join(' ')}>
|
||||
<div
|
||||
className={[
|
||||
'relative',
|
||||
@@ -96,6 +100,18 @@ const Layout: FC<Props> = (props) => {
|
||||
)}
|
||||
<div className="max-w-xs w-32 h-[1px] bg-gradient-to-r from-brand-800 to-brand-900 my-8"></div>
|
||||
<MDXProvider components={components}>{props.children}</MDXProvider>
|
||||
<div className="mt-16 not-prose">
|
||||
<div>
|
||||
<Link
|
||||
href={`https://github.com/supabase/supabase/edit/master/apps/docs/pages${router.asPath}.mdx`}
|
||||
passHref
|
||||
>
|
||||
<a className="text-sm transition flex items-center gap-1 text-scale-1000 hover:text-scale-1200">
|
||||
Edit this page on GitHub <IconExternalLink size={14} strokeWidth={1.5} />
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
{!props.hideToc && hasTableOfContents && !props.meta?.hide_table_of_contents && (
|
||||
|
||||
@@ -4,6 +4,7 @@ import { highlightSelectedNavItem } from '~/components/CustomHTMLElements/Custom
|
||||
import { useRouter } from 'next/router'
|
||||
import { useNavigationMenuContext } from '~/components/Navigation/NavigationMenu/NavigationMenu.Context'
|
||||
import { menuState } from '~/hooks/useMenuState'
|
||||
import Image from 'next/image'
|
||||
|
||||
interface ISectionContainer {
|
||||
id: string
|
||||
@@ -34,7 +35,9 @@ type StickyHeader = {
|
||||
|
||||
type RefSubLayoutType = {}
|
||||
|
||||
interface IEducationRow {}
|
||||
interface IEducationRow {
|
||||
className?: string
|
||||
}
|
||||
interface IEducationSection {
|
||||
id: string
|
||||
title?: string
|
||||
@@ -75,8 +78,13 @@ const Section: FC<ISectionContainer> = (props) => {
|
||||
|
||||
const StickyHeader: FC<StickyHeader> = ({ icon, ...props }) => {
|
||||
const router = useRouter()
|
||||
|
||||
const { setActiveRefItem } = useNavigationMenuContext()
|
||||
|
||||
// we're serving search bots a different file (/crawlers/[...slug])
|
||||
// and need to modify content to suit that
|
||||
const isCrawlerPage = router.route.includes('/crawlers/[...slug]')
|
||||
|
||||
const { ref } = useInView({
|
||||
threshold: 1,
|
||||
rootMargin: '30% 0% -35% 0px',
|
||||
@@ -97,21 +105,25 @@ const StickyHeader: FC<StickyHeader> = ({ icon, ...props }) => {
|
||||
<div className={['flex items-center gap-3 not-prose', icon && 'mb-8'].join(' ')}>
|
||||
{icon && (
|
||||
<div className="w-8 h-8 bg-brand-500 rounded flex items-center justify-center">
|
||||
<img className="w-6 h-6" src={`${icon}.svg`} />
|
||||
<Image width={16} height={16} alt={icon} src={`${icon}.svg`} />
|
||||
</div>
|
||||
)}
|
||||
<h2
|
||||
ref={ref}
|
||||
id={props.slug}
|
||||
data-ref-id={props.id}
|
||||
className={[
|
||||
'text-2xl font-medium text-scale-1200 scroll-mt-24',
|
||||
!icon && 'mb-8',
|
||||
props.monoFont && 'font-mono',
|
||||
].join(' ')}
|
||||
>
|
||||
{props.title && <span className="max-w-xl">{props.title}</span>}
|
||||
</h2>
|
||||
{isCrawlerPage ? (
|
||||
<h1>{props.title}</h1>
|
||||
) : (
|
||||
<h2
|
||||
ref={ref}
|
||||
id={props.slug}
|
||||
data-ref-id={props.id}
|
||||
className={[
|
||||
'text-2xl font-medium text-scale-1200 scroll-mt-24',
|
||||
!icon && 'mb-8',
|
||||
props.monoFont && 'font-mono',
|
||||
].join(' ')}
|
||||
>
|
||||
{props.title && <span className="max-w-xl">{props.title}</span>}
|
||||
</h2>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -129,7 +141,11 @@ const Examples: FC<ISectionExamples> = (props) => {
|
||||
}
|
||||
|
||||
const EducationRow: FC<IEducationRow> = (props) => {
|
||||
return <div className="grid lg:grid-cols-2 gap-8 lg:gap-16">{props.children}</div>
|
||||
return (
|
||||
<div className={['grid lg:grid-cols-2 gap-8 lg:gap-16', props.className].join(' ')}>
|
||||
{props.children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const EducationSection: FC<IEducationSection> = ({ icon, hideTitle = false, ...props }) => {
|
||||
|
||||
@@ -2,7 +2,6 @@ import { MDXProvider } from '@mdx-js/react'
|
||||
import Head from 'next/head'
|
||||
import { FC, useEffect, useState } from 'react'
|
||||
import components from '~/components'
|
||||
import Footer from '~/components/Footer'
|
||||
import SideBar from '~/components/Navigation/SideBar'
|
||||
import TableOfContents from '~/components/TableOfContents'
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// @ts-expect-error
|
||||
import specStorageV0 from '~/../../spec/storage_v0_config.yaml' assert { type: 'yml' }
|
||||
// @ts-expect-error
|
||||
import specRealtimeV0 from '~/../../spec/realtime_v0_config.yaml' assert { type: 'yml' }
|
||||
// @ts-expect-error
|
||||
import specAuthV1 from '~/../../spec/gotrue_v1_config.yaml' assert { type: 'yml' }
|
||||
|
||||
function getStorageConfigV0() {
|
||||
return { ...specStorageV0 }
|
||||
}
|
||||
|
||||
function getRealtimeConfigV0() {
|
||||
return { ...specRealtimeV0 }
|
||||
}
|
||||
|
||||
function getAuthConfigV1() {
|
||||
return { ...specAuthV1 }
|
||||
}
|
||||
|
||||
export { getStorageConfigV0, getRealtimeConfigV0, getAuthConfigV1 }
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TsDoc } from '~/generator/legacy/definitions'
|
||||
import { TsDoc } from '../../generator/legacy/definitions'
|
||||
|
||||
import { values, mapValues } from 'lodash'
|
||||
import { OpenAPIV3 } from 'openapi-types'
|
||||
@@ -61,6 +61,8 @@ function recurseThroughParams(paramDefinition: any) {
|
||||
children = dereferenced.children
|
||||
} else if (dereferenced.type?.declaration?.children) {
|
||||
children = dereferenced.type.declaration.children
|
||||
} else if (dereferenced.type?.type === 'query') {
|
||||
// skip: ignore types created from `typeof` for now, like `type Fetch = typeof fetch`
|
||||
} else if (dereferenced.type?.type === 'union') {
|
||||
// skip: we don't want to show unions as nested parameters
|
||||
} else if (Object.keys(dereferenced).length === 0) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"build:sitemap": "node ./internals/generate-sitemap.mjs",
|
||||
"postbuild": "node ./scripts/build-search.js && node ./internals/generate-sitemap.mjs",
|
||||
"postbuild": "ts-node ./scripts/build-search.ts && node ./internals/generate-sitemap.mjs",
|
||||
"generate:all": "npm-run-all --parallel gen:api gen:cli gen:gotrue gen:storage gen:supabase-dart:v0 gen:supabase-dart:v1 gen:supabase-js:v1 gen:supabase-js:v2 gen:realtime",
|
||||
"gen:api": "npm-run-all gen:api:usage",
|
||||
"gen:api:usage": "ts-node ./generator/index.ts gen --type api --url https://api.supabase.com --input ../../spec/transforms/api_v0_openapi_deparsed.json --output ./docs/reference/api/generated/usage.mdx",
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
import toc from 'markdown-toc'
|
||||
import { MDXRemote } from 'next-mdx-remote'
|
||||
import { serialize } from 'next-mdx-remote/serialize'
|
||||
import components from '../components/index'
|
||||
import NewLayout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
import Layout from '~/layouts/Default'
|
||||
import { getAllDocs, getDocsBySlug } from '../lib/docs'
|
||||
|
||||
interface Meta {
|
||||
id: string
|
||||
title: string
|
||||
sidebar_label: string
|
||||
hide_table_of_contents: boolean
|
||||
}
|
||||
|
||||
interface Props {
|
||||
meta: Meta
|
||||
content: any
|
||||
toc: any
|
||||
}
|
||||
const isNewDocs = process.env.NEXT_PUBLIC_NEW_DOCS === 'true'
|
||||
|
||||
export default function Doc({ meta, content, toc }: Props) {
|
||||
return (
|
||||
// @ts-ignore
|
||||
<>
|
||||
{Object.entries(meta).length > 0 || !isNewDocs ? (
|
||||
<Layout meta={meta} toc={toc}>
|
||||
<MDXRemote {...content} components={components} />
|
||||
</Layout>
|
||||
) : (
|
||||
<NewLayout meta={meta} toc={toc}>
|
||||
<MDXRemote {...content} components={components} />
|
||||
</NewLayout>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export async function getStaticProps({ params }: { params: { slug: string[] } }) {
|
||||
let slug
|
||||
if (params.slug.length > 1) {
|
||||
slug = `docs/${params.slug.join('/')}`
|
||||
} else {
|
||||
slug = `docs/${params.slug[0]}`
|
||||
}
|
||||
|
||||
let doc = getDocsBySlug(slug)
|
||||
const content = await serialize(doc.content || '')
|
||||
|
||||
return {
|
||||
props: {
|
||||
...doc,
|
||||
content,
|
||||
toc: toc(doc.content, { maxdepth: 1, firsth1: false }),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function getStaticPaths() {
|
||||
let docs = getAllDocs()
|
||||
|
||||
return {
|
||||
paths: docs.map(() => {
|
||||
return {
|
||||
params: {
|
||||
slug: docs.map((d) => d.slug),
|
||||
},
|
||||
}
|
||||
}),
|
||||
fallback: 'blocking',
|
||||
}
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'architecture',
|
||||
title: 'Architecture',
|
||||
description: 'Supabase design and architecture',
|
||||
}
|
||||
|
||||
Supabase is open source. We choose open source tools which are scalable and make them simple to use.
|
||||
|
||||
Supabase is not a 1-to-1 mapping of Firebase. While we are building many of the features that Firebase offers, we are not going about it the same way:
|
||||
our technological choices are quite different; everything we use is open source; and wherever possible, we use and support existing tools rather than developing from scratch.
|
||||
|
||||
Most notably, we use Postgres rather than a NoSQL store. This choice was deliberate. We believe that no other database offers the functionality required to compete with Firebase,
|
||||
while maintaining the scalability required to go beyond it.
|
||||
|
||||
## Architecture
|
||||
|
||||
Each Supabase project consists of several tools:
|
||||
|
||||

|
||||
|
||||
### PostgreSQL (Database)
|
||||
|
||||
PostgreSQL is the core of Supabase. We do not abstract the PostgreSQL database — you can access it and use it with full privileges. We simply provide tools which makes PostgreSQL as easy to use as Firebase.
|
||||
|
||||
- Official Docs: [postgresql.org/docs](https://www.postgresql.org/docs/current/index.html)
|
||||
- Source code: [github.com/postgres/postgres](https://github.com/postgres/postgres) (mirror)
|
||||
- License: [PostgreSQL Licence](https://www.postgresql.org/about/licence/)
|
||||
- Language: C
|
||||
|
||||
### Studio (Dashboard)
|
||||
|
||||
An open source Dashboard for managing your database and services.
|
||||
|
||||
- Official Docs: [Supabase docs](/docs)
|
||||
- Source code: [github.com/supabase/supabase](https://github.com/supabase/supabase/tree/master/studio)
|
||||
- License: [Apache 2](https://github.com/supabase/supabase/blob/master/LICENSE)
|
||||
- Language: TypeScript
|
||||
|
||||
### GoTrue (Auth)
|
||||
|
||||
A JWT-based API for managing users and issuing access tokens. This integrates with PostgreSQL's Row Level Security and the API servers.
|
||||
|
||||
- Official Docs: [Supabase Auth reference docs](/docs/reference/auth)
|
||||
- Source code: [github.com/supabase/gotrue](https://github.com/supabase/gotrue)
|
||||
- License: [MIT](https://github.com/supabase/gotrue/blob/master/LICENSE)
|
||||
- Language: Go
|
||||
|
||||
### PostgREST (API)
|
||||
|
||||
A standalone web server that turns your PostgreSQL database directly into a RESTful API.
|
||||
We use this with our [pg_graphql](https://github.com/supabase/pg_graphql) extension to provide a GraphQL API.
|
||||
|
||||
- Official Docs: [postgrest.org](https://postgrest.org/)
|
||||
- Source code: [github.com/PostgREST/postgrest](https://github.com/PostgREST/postgrest)
|
||||
- License: [MIT](https://github.com/PostgREST/postgrest/blob/main/LICENSE)
|
||||
- Language: Haskel
|
||||
|
||||
### Realtime (API & multiplayer)
|
||||
|
||||
A scalable websocket engine for managing user Presence, broadcasting messages, and streaming database changes.
|
||||
|
||||
- Official Docs: [Supabase Realtime docs](/docs/guides/realtime)
|
||||
- Source code: [github.com/supabase/realtime](https://github.com/supabase/realtime)
|
||||
- License: [Apache 2](https://github.com/supabase/realtime/blob/master/LICENSE)
|
||||
- Language: Elixir
|
||||
|
||||
### Storage API (large file storage)
|
||||
|
||||
An S3-compatible object storage service that stores metadata in Postgres.
|
||||
|
||||
- Official Docs: [Supabase Storage reference docs](/docs/reference/storage)
|
||||
- Source code: [github.com/supabase/storage-api](https://github.com/supabase/storage-api)
|
||||
- License: [Apache 2.0](https://github.com/supabase/storage-api/blob/master/LICENSE)
|
||||
- Language: NodeJS / TypeScript
|
||||
|
||||
### Deno (Edge Functions)
|
||||
|
||||
A modern runtime for JavaScript and TypeScript.
|
||||
|
||||
- Official Docs: [deno.land](https://deno.land/)
|
||||
- Source code: [github.com/denoland/deno](https://github.com/denoland/deno)
|
||||
- License: [MIT](https://github.com/denoland/deno/blob/main/LICENSE.md)
|
||||
- Language: TypeScript / Rust
|
||||
|
||||
### postgres-meta (Database management)
|
||||
|
||||
A RESTful API for managing your Postgres. Fetch tables, add roles, and run queries.
|
||||
|
||||
- Official Docs: [supabase.github.io/postgres-meta](https://supabase.github.io/postgres-meta/)
|
||||
- Source code: [github.com/supabase/postgres-meta](https://github.com/supabase/postgres-meta)
|
||||
- License: [Apache 2.0](https://github.com/supabase/postgres-meta/blob/master/LICENSE)
|
||||
- Language: NodeJS / TypeScript
|
||||
|
||||
### PgBouncer
|
||||
|
||||
A lightweight connection pooler for PostgreSQL. This is useful for connecting to Postgres when using Serverless functions.
|
||||
|
||||
- Official Docs: [pgbouncer.org](http://www.pgbouncer.org/)
|
||||
- Source code: [pgbouncer/pgbouncer](https://github.com/pgbouncer/pgbouncer)
|
||||
- License: [ISC](https://github.com/pgbouncer/pgbouncer/blob/master/COPYRIGHT)
|
||||
- Language: C
|
||||
|
||||
### Kong (API Gateway)
|
||||
|
||||
A cloud-native API gateway, built on top of Nginx.
|
||||
|
||||
- Official Docs: [docs.konghq.com](https://docs.konghq.com/)
|
||||
- Source code: [github.com/kong/kong](https://github.com/kong/kong)
|
||||
- License: [Apache 2.0](https://github.com/Kong/kong/blob/master/LICENSE)
|
||||
- Language: Lua
|
||||
|
||||
## Product Principles
|
||||
|
||||
It is our goal to provide an architecture that any large-scale company would design for themselves,
|
||||
and then provide tooling around that architecture that is easy-to-use for indie-developers and small teams.
|
||||
|
||||
We use a series of principles to ensure that scalability and usability are never mutually exclusive:
|
||||
|
||||
### Everything works in isolation
|
||||
|
||||
Each system must work as a standalone tool with as few moving parts as possible.
|
||||
The litmus test for this is: "Can a user run this product with nothing but a Postgres database?"
|
||||
|
||||
### Everything is integrated
|
||||
|
||||
Supabase is composable. Even though every product works in isolation, each product on the platform needs to 10x the other products.
|
||||
For integration, each tool should expose an API and Webhooks.
|
||||
|
||||
### Everything is extensible
|
||||
|
||||
We're deliberate about adding a new tool, and prefer instead to extend an existing one.
|
||||
This is the opposite of many cloud providers whose product offering expands into niche use-cases. We provide _primitives_ for developers, which allow them to achieve any goal.
|
||||
Less, but better.
|
||||
|
||||
### Everything is portable
|
||||
|
||||
To avoid lock-in, we make it easy to migrate in and out. Our cloud offering is compatible with our self-hosted product.
|
||||
We use existing standards to increase portability (like pg_dump an CSV files). If a new standard emerges which competes with a "Supabase" approach, we will deprecate the approach in favor of the standard.
|
||||
This forces us compete on experience. We aim to be the best Postgres hosting service.
|
||||
|
||||
### Play the long game
|
||||
|
||||
We sacrifice short-term wins for long-term gains. For example, it is tempting to run a fork of Postgres with additional functionality which only our customers need.
|
||||
Instead, we prefer to support efforts to upstream missing functionality so that the entire community benefits. This has the additional benefit of ensuring portability and longevity.
|
||||
|
||||
### Build for developers
|
||||
|
||||
"Developers" are a specific profile of user: they are _builders_.
|
||||
When assessing impact as a function of effort, developers have a large efficiency due to the type of products and systems they can build.
|
||||
As the profile of a developer changes over time, Supabase will continue to evolve the product to fit this evolving profile.
|
||||
|
||||
### Support existing tools
|
||||
|
||||
Supabase supports existing tools and communities wherever possible. Supabase is more like a "community of communities" - each tool typically has its own community
|
||||
which we work with.
|
||||
Open source is something we approach [collaboratively](https://supabase.com/blog/supabase-series-b#giving-back): we employ maintainers, sponsor projects, invest in businesses, and develop our own open source tools.
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,184 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'features',
|
||||
title: 'Features',
|
||||
description: 'Supabase features',
|
||||
}
|
||||
|
||||
This is a non-exhaustive list of features that Supabase provides for every project.
|
||||
|
||||
## Database
|
||||
|
||||
### Postgres Database
|
||||
|
||||
Every project is a full Postgres database. [Docs](/docs/guides/database).
|
||||
|
||||
### Database Extensions
|
||||
|
||||
Every database comes with a full set of Postgres extensions. [Docs](/docs/guides/database/extensions).
|
||||
|
||||
### Database Functions
|
||||
|
||||
Create custom database functions which you can call from the browser. [Docs](/docs/guides/database/functions).
|
||||
|
||||
### Database Triggers
|
||||
|
||||
Attach triggers to your tables to handle database changes. [Docs](/docs/guides/auth/managing-user-data#using-triggers).
|
||||
|
||||
### Database Webhooks
|
||||
|
||||
Send database changes to any external service using Webhooks. [Link](https://supabase.com/blog/supabase-functions-updates#database-webhooks-alpha).
|
||||
|
||||
### Database Backups
|
||||
|
||||
Projects are backed up daily with the option to upgrade to Point in Time recovery.
|
||||
|
||||
### Search
|
||||
|
||||
Build search functionality using Postgres Full Text Search. [Docs](/docs/guides/database/full-text-search).
|
||||
|
||||
### Secrets and encryption
|
||||
|
||||
Encrypt sensitive data and store secrets using our Postgres extension, Supabase Vault. [Link](https://supabase.com/blog/supabase-vault).
|
||||
|
||||
### Database migrations
|
||||
|
||||
Develop locally and push your changes to your production database using migrations. [Docs](/docs/guides/cli/local-development#database-migrations)
|
||||
|
||||
<br />
|
||||
|
||||
## Auth
|
||||
|
||||
### Email & Password Logins
|
||||
|
||||
Build email logins for your application or website. [Docs](/docs/guides/auth/auth-email).
|
||||
|
||||
### Magic Links
|
||||
|
||||
Build passwordless logins for your application or website.[Docs](/docs/guides/auth/auth-magic-link).
|
||||
|
||||
### Social Logins
|
||||
|
||||
Provide social logins - everything from Apple, to GitHub, to Slack. [Docs](/docs/guides/auth/auth-apple).
|
||||
|
||||
### Phone Logins
|
||||
|
||||
Provide phone logins using a 3rd-party SMS provider. [Docs](/docs/guides/auth/auth-twilio).
|
||||
|
||||
### Row Level Security
|
||||
|
||||
Control the data each user can access with Postgres Policies. [Docs](/docs/guides/auth/row-level-security).
|
||||
|
||||
### Serverside Auth Helpers
|
||||
|
||||
Helpers for implementing user authentication in popular frameworks like [Next.js](/docs/guides/auth/auth-helpers/nextjs) and [SvelteKit](/docs/guides/auth/auth-helpers/sveltekit)
|
||||
|
||||
### Auth UI Kit
|
||||
|
||||
Build login and registration pages with custom themes. [Docs](/docs/guides/auth/auth-helpers/auth-ui).
|
||||
|
||||
<br />
|
||||
|
||||
## APIs & Client libraries
|
||||
|
||||
### Auto-generated REST API
|
||||
|
||||
RESTful APIs are autogenerated from your database, without a single line of code. [Docs](/docs/guides/api#rest-api-overview).
|
||||
|
||||
### Auto-generated GraphQL API
|
||||
|
||||
Fast GraphQL APIs using our custom Postgres GraphQL extension. [Docs](/docs/guides/api#graphql-api-overview).
|
||||
|
||||
### Realtime Database changes
|
||||
|
||||
Receive your database changes through websockets. [Docs](/docs/guides/realtime/postgres-changes).
|
||||
|
||||
### User Broadcasting
|
||||
|
||||
Send messages between connected users through websockets. [Docs](/docs/guides/realtime#broadcast).
|
||||
|
||||
### User Presence
|
||||
|
||||
Synchronize shared state across your users, including online status and typing indicators. [Docs](/docs/guides/realtime#presence).
|
||||
|
||||
### Client libraries
|
||||
|
||||
Official client libraries for [JavaScript](/docs/reference/javascript/) and [Dart](/docs/reference/dart).
|
||||
Unofficial libraries [supported by the community](https://github.com/supabase-community#client-libraries).
|
||||
|
||||
<br />
|
||||
|
||||
## Storage
|
||||
|
||||
### File storage
|
||||
|
||||
Supabase Storage makes it simple to store and serve files. [Docs](/docs/guides/storage).
|
||||
|
||||
### Storage CDN
|
||||
|
||||
Cache large files using the Supabase CDN. [Docs](/docs/guides/storage-cdn).
|
||||
|
||||
### Image Transformations
|
||||
|
||||
Transform images on the fly. [Docs](/docs/guides/storage/image-transformations).
|
||||
|
||||
<br />
|
||||
|
||||
## Edge Functions
|
||||
|
||||
### Deno Edge Functions
|
||||
|
||||
Globally distributed TypeScript functions to execute custom business logic. [Docs](/docs/guides/functions).
|
||||
|
||||
<br />
|
||||
|
||||
## Project Management
|
||||
|
||||
### CLI
|
||||
|
||||
Use our CLI to develop your project locally and deploy to the Supabase Platform. [Docs](/docs/reference/cli).
|
||||
|
||||
### Management API
|
||||
|
||||
Manage your projects programmatically. [Docs](/docs/reference/api).
|
||||
|
||||
<br />
|
||||
|
||||
## Feature Status
|
||||
|
||||
Both Postgres and the Supabase Platform are production-ready. Some tools we offer on top of Postgres are still under development.
|
||||
|
||||
| Product | Feature | Stage |
|
||||
| -------------------------- | ---------------------- | ------- |
|
||||
| Database | Postgres | `GA` |
|
||||
| Database | Triggers | `GA` |
|
||||
| Database | Functions | `GA` |
|
||||
| Database | Extensions | `GA` |
|
||||
| Database | Full Text Search | `GA` |
|
||||
| Database | Webhooks | `alpha` |
|
||||
| Database | Point-in-Time Recovery | `alpha` |
|
||||
| Database | Vault | `alpha` |
|
||||
| Studio | | `GA` |
|
||||
| Realtime | Postgres Changes | `GA` |
|
||||
| Realtime | Broadcast | `beta` |
|
||||
| Realtime | Presence | `beta` |
|
||||
| Storage | | `GA` |
|
||||
| Storage | S3 Backend | `GA` |
|
||||
| Storage | CDN | `GA` |
|
||||
| Storage | Smart CDN | `beta` |
|
||||
| Storage | Image Transformations | `beta` |
|
||||
| Edge Functions | | `beta` |
|
||||
| Auth | OAuth Providers | `beta` |
|
||||
| Auth | Passwordless | `beta` |
|
||||
| Auth | Next.js Auth Helpers | `alpha` |
|
||||
| Auth | SvelteKit Auth Helpers | `alpha` |
|
||||
| Auth | Remix Auth Helpers | `alpha` |
|
||||
| Management API | | `beta` |
|
||||
| CLI | | `beta` |
|
||||
| Client Library: JavaScript | | `GA` |
|
||||
| Client Library: Dart | | `beta` |
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,185 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import NewContent from '~/pages/new/auth.mdx'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth',
|
||||
title: 'Auth',
|
||||
description: 'Use Supabase to Authenticate and Authorize your users.',
|
||||
sidebar_label: 'Overview',
|
||||
}
|
||||
|
||||
## Overview
|
||||
|
||||
There are two parts to every Auth system:
|
||||
|
||||
- **Authentication:** should this person be allowed in? If yes, who are they?
|
||||
- **Authorization:** once they are in, what are they allowed to do?
|
||||
|
||||
Supabase Auth is designed to work either as a standalone product, or deeply integrated with the other Supabase products.
|
||||
Postgres is at the heart of everything we do, and the Auth system follows this principle. We leverage Postgres' built-in Auth functionality wherever possible.
|
||||
|
||||
Here's a quick, 2 minute tour of the Auth features built-in to Supabase:
|
||||
|
||||
<div className="video-container">
|
||||
<iframe
|
||||
src="https://www.youtube-nocookie.com/embed/6ow_jW4epf8"
|
||||
frameBorder="1"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowFullScreen
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
## Authentication
|
||||
|
||||
You can authenticate your users in several ways:
|
||||
|
||||
- Email & password.
|
||||
- Magic links (one-click logins).
|
||||
- Social providers.
|
||||
- Phone logins.
|
||||
|
||||
### Providers
|
||||
|
||||
We provide a suite of Providers and login methods, as well as [Auth helpers](/docs/guides/auth/auth-helpers/).
|
||||
|
||||
<div className="container" style={{ padding: 0 }}>
|
||||
<AuthProviders />
|
||||
</div>
|
||||
|
||||
### Configure third-party providers
|
||||
|
||||
You can enable third-party providers with the click of a button by navigating to Authentication > Settings > Auth Providers and inputting your `Client ID` and `Secret` for each.
|
||||
|
||||

|
||||
|
||||
### Redirect URLs and wildcards
|
||||
|
||||
When using third-party providers, the [Supabase client library](/docs/reference/javascript/auth-signinwithoauth#sign-in-using-a-third-party-provider-with-redirect) redirects the user to the provider. When the third-party provider successfully authenticates the user, the provider redirects the user to the Supabase Auth callback URL where they are further redirected to the URL specified in the `redirectTo` parameter. This parameter defaults to the [`SITE_URL`](/docs/reference/auth/config#site_url). You can modify the `SITE_URL` or [add additional redirect URLs](https://app.supabase.com/project/_/auth/settings).
|
||||
|
||||
You can use wildcard match patterns to support preview URLs from providers like Netlify and Vercel. See the [full list of supported patterns](https://pkg.go.dev/github.com/gobwas/glob#Compile). Use [this tool](https://www.digitalocean.com/community/tools/glob?comments=true&glob=http%3A%2F%2Flocalhost%3A3000%2F%2A%2A&matches=false&tests=http%3A%2F%2Flocalhost%3A3000&tests=http%3A%2F%2Flocalhost%3A3000%2F&tests=http%3A%2F%2Flocalhost%3A3000%2F%3Ftest%3Dtest&tests=http%3A%2F%2Flocalhost%3A3000%2Ftest-test%3Ftest%3Dtest&tests=http%3A%2F%2Flocalhost%3A3000%2Ftest%2Ftest%3Ftest%3Dtest) to test your patterns.
|
||||
|
||||
> ⚠️ WARNING: While the "globstar" (`**`) is useful for local development and preview URLs, we recommend setting the exact redirect URL path for your site URL in production.
|
||||
|
||||
#### Netlify preview URLs
|
||||
|
||||
For deployments with Netlify, set the `SITE_URL` to your official site URL. Add the following additional redirect URLs for local development and deployment previews:
|
||||
|
||||
- `http://localhost:3000/**`
|
||||
- `https://**--my_org.netlify.app/**`
|
||||
|
||||
#### Vercel preview URLs
|
||||
|
||||
For deployments with Vercel, set the `SITE_URL` to your official site URL. Add the following additional redirect URLs for local development and deployment previews:
|
||||
|
||||
- `http://localhost:3000/**`
|
||||
- `https://*-username.vercel.app/**`
|
||||
|
||||
Vercel provides an environment variable for the URL of the deployment called `NEXT_PUBLIC_VERCEL_URL`. See the [Vercel docs](https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables) for more details. You can use this variable to dynamically redirect depending on the environment:
|
||||
|
||||
```js
|
||||
const getURL = () => {
|
||||
let url =
|
||||
process?.env?.NEXT_PUBLIC_SITE_URL ?? // Set this to your site URL in production env.
|
||||
process?.env?.NEXT_PUBLIC_VERCEL_URL ?? // Automatically set by Vercel.
|
||||
'http://localhost:3000/';
|
||||
// Make sure to include `https://` when not localhost.
|
||||
url = url.includes('http') ? url : `https://${url}`;
|
||||
// Make sure to including trailing `/`.
|
||||
url = url.charAt(url.length - 1) === '/' ? url : `${url}/`;
|
||||
return url;
|
||||
};
|
||||
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'github'
|
||||
options: {
|
||||
redirectTo: getURL()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Mobile deep linking URIs
|
||||
|
||||
For mobile applications you can use deep linking URIs. For example for your `SITE_URL` you can specify something like `com.supabase://login-callback/` and for additional redirect URLs something like `com.supabase.staging://login-callback/` if needed.
|
||||
|
||||
## Authorization
|
||||
|
||||
When you need granular authorization rules, nothing beats PostgreSQL's Row Level Security (RLS).
|
||||
|
||||
Policies are PostgreSQL's rule engine. They are incredibly powerful and flexible, allowing you to write complex SQL rules which fit your unique business needs.
|
||||
|
||||
Get started with our [Row Level Security Guides](/docs/guides/auth/row-level-security).
|
||||
|
||||
### Row Level Security
|
||||
|
||||
Authentication only gets you so far. When you need granular authorization rules, nothing beats PostgreSQL's [Row Level Security (RLS)](https://www.postgresql.org/docs/current/ddl-rowsecurity.html). Supabase makes it simple to turn RLS on and off.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/rls-zoom2.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
### Policies
|
||||
|
||||
[Policies](https://www.postgresql.org/docs/current/sql-createpolicy.html) are PostgreSQL's rule engine. They are incredibly powerful and flexible, allowing you to write complex SQL rules which fit your unique business needs.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/policies-zoom2.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
With policies, your database becomes the rules engine. Instead of repetitively filtering your queries, like this ...
|
||||
|
||||
```js
|
||||
const loggedInUserId = 'd0714948'
|
||||
let { data, error } = await supabase
|
||||
.from('users')
|
||||
.select('user_id, name')
|
||||
.eq('user_id', loggedInUserId)
|
||||
|
||||
// console.log(data)
|
||||
// => { id: 'd0714948', name: 'Jane' }
|
||||
```
|
||||
|
||||
... you can simply define a rule on your database table, `auth.uid() = user_id`, and your request will return the rows which pass the rule, even when you remove the filter from your middleware:
|
||||
|
||||
```js
|
||||
let { data, error } = await supabase.from('users').select('user_id, name')
|
||||
|
||||
// console.log(data)
|
||||
// Still => { id: 'd0714948', name: 'Jane' }
|
||||
```
|
||||
|
||||
### How It Works
|
||||
|
||||
1. A user signs up. Supabase creates a new user in the `auth.users` table.
|
||||
2. Supabase returns a new JWT, which contains the user's `UUID`.
|
||||
3. Every request to your database also sends the JWT.
|
||||
4. Postgres inspects the JWT to determine the user making the request.
|
||||
5. The user's UID can be used in policies to restrict access to rows.
|
||||
|
||||
Supabase provides a special function in Postgres, `auth.uid()`, which extracts the user's UID from the JWT. This is especially useful when creating policies.
|
||||
|
||||
## User Management
|
||||
|
||||
Supabase provides multiple endpoints to authenticate and manage your users:
|
||||
|
||||
- [Sign up](/docs/reference/javascript/auth-signup)
|
||||
- [Sign in with password](/docs/reference/javascript/auth-signinwithpassword)
|
||||
- [Sign in with passwordless / one-time password (OTP)](/docs/reference/javascript/auth-signinwithotp)
|
||||
- [Sign in with OAuth](/docs/reference/javascript/auth-signinwithoauth)
|
||||
- [Sign out](/docs/reference/javascript/auth-signout)
|
||||
|
||||
When users sign up, Supabase assigns them a unique ID. You can reference this ID anywhere in your database. For example, you might create a `profiles` table referencing `id` in the `auth.users` table using a `user_id` field.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/auth-zoom2.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
const router = useRouter()
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true' && !router.asPath.includes('overview')) {
|
||||
return NewContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
}
|
||||
|
||||
export default Page
|
||||
@@ -1,207 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-apple',
|
||||
title: 'Login with Apple',
|
||||
description: 'Add Apple OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable Apple Auth for your project, you need to set up an Apple OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Apple OAuth consists of six broad steps:
|
||||
|
||||
- Obtaining an `App Id` with “Sign In with Apple” capabilities.
|
||||
- Obtaining a `Services Id` - this will serve as the `client_id`.
|
||||
- Obtaining a `secret key` that will be used to get our `client_secret`.
|
||||
- Generating the `client_secret` using the `secret key`.
|
||||
- Add your `client id` and `client secret` keys to your [Supabase Project](https://app.supabase.com).
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js).
|
||||
|
||||
## Access your Apple Developer account
|
||||
|
||||
- Go to [developer.apple.com](https://developer.apple.com).
|
||||
- Click on `Account` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Obtain an App ID
|
||||
|
||||
- Go to `Certificates, Identifiers & Profiles`.
|
||||
- Click on `Identifiers` at the left.
|
||||
- Click on the `+` sign in the upper left next to `Identifiers`.
|
||||
- Select `App IDs` and click `Continue`.
|
||||
- Select type `App` and click `Continue`.
|
||||
- Fill out your app information:
|
||||
- App description.
|
||||
- Bundle ID (Apple recommends reverse-domain name style, so if your domain is acme.com and your app is called roadrunner, use: "com.acme.roadrunner").
|
||||
- Scroll down and check `Sign In With Apple`.
|
||||
- Click `Continue` at the top right.
|
||||
- Click `Register` at the top right.
|
||||
|
||||
## Obtain a Services ID
|
||||
|
||||
This will serve as the `client_id` when you make API calls to authenticate the user.
|
||||
|
||||
- Go to `Certificates, Identifiers & Profiles`.
|
||||
- Click on `Identifiers` at the left.
|
||||
- Click on the `+` sign in the upper left next to `Identifiers`.
|
||||
- Select `Services IDs` and click `Continue`.
|
||||
- Fill out your information:
|
||||
- App description.
|
||||
- Bundle ID (you can't use the same Bundle ID from the previous step, but you can just add something to the beginning, such as "app." to make it app.com.acme.roadrunner").
|
||||
- SAVE THIS ID -- this ID will become your `client_id` later.
|
||||
- Click `Continue` at the top right.
|
||||
- Click `Register` at the top right.
|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Configure your Services ID
|
||||
|
||||
- Under `Identifiers`, click on your newly-created Services ID.
|
||||
- Check the box next to `Sign In With Apple` to enable it.
|
||||
- Click `Configure` to the right.
|
||||
- Make sure your newly created Bundle ID is selected under `Primary App ID`
|
||||
- Add your domain to the `Domains and Subdomains` box (do not add `https://`, just add the domain).
|
||||
- In the `Return URLs` box, type the callback URL of your app which you found in the previous step and click `Next` at the bottom right.
|
||||
- Click `Done` at the bottom.
|
||||
- Click `Continue` at the top right.
|
||||
- Click `Save` at the top right.
|
||||
|
||||
## Download your secret key
|
||||
|
||||
Now you'll need to download a `secret key` file from Apple that will be used to generate your `client_secret`.
|
||||
|
||||
- Go to `Certificates, Identifiers & Profiles`.
|
||||
- Click on `Keys` at the left.
|
||||
- Click on the `+` sign in the upper left next to `Keys`.
|
||||
- Enter a `Key Name`.
|
||||
- Check `Sign In with Apple`.
|
||||
- Click `Configure` to the right.
|
||||
- Select your newly-created Services ID from the dropdown selector.
|
||||
- Click `Save` at the top right.
|
||||
- Click `Continue` at the top right.
|
||||
- Click `Register` at the top right.
|
||||
- Click `Download` at the top right.
|
||||
- Save the downloaded file -- this contains your "secret key" that will be used to generate your `client_secret`.
|
||||
- Click `Done` at the top right.
|
||||
|
||||
## Generate a `client_secret`
|
||||
|
||||
The `secret key` you downloaded is used to create the `client_secret` string you'll need to authenticate your users.
|
||||
|
||||
According to the [Apple Docs](https://developer.apple.com/documentation/signinwithapplerestapi/generate_and_validate_tokens) it needs to be a JWT
|
||||
token encrypted using the Elliptic Curve Digital Signature Algorithm (ECDSA) with the P-256 curve and the SHA-256 hash algorithm.
|
||||
|
||||
At this time, the easiest way to generate this JWT token is with [Ruby](https://www.ruby-lang.org/en/).
|
||||
If you don't have Ruby installed, you can [Download Ruby Here](https://www.ruby-lang.org/en/downloads).
|
||||
|
||||
- Install Ruby (or check to make sure it's installed on your system).
|
||||
- Install [ruby-jwt](https://github.com/jwt/ruby-jwt).
|
||||
- From the command line, run: `sudo gem install jwt`.
|
||||
|
||||
Create the script below using a text editor: `secret_gen.rb`
|
||||
|
||||
```ruby
|
||||
require "jwt"
|
||||
|
||||
key_file = "Path to the private key"
|
||||
team_id = "Your Team ID"
|
||||
client_id = "The Service ID of the service you created"
|
||||
key_id = "The Key ID of the private key"
|
||||
|
||||
validity_period = 180 # In days. Max 180 (6 months) according to Apple docs.
|
||||
|
||||
private_key = OpenSSL::PKey::EC.new IO.read key_file
|
||||
|
||||
token = JWT.encode(
|
||||
{
|
||||
iss: team_id,
|
||||
iat: Time.now.to_i,
|
||||
exp: Time.now.to_i + 86400 * validity_period,
|
||||
aud: "https://appleid.apple.com",
|
||||
sub: client_id
|
||||
},
|
||||
private_key,
|
||||
"ES256",
|
||||
header_fields=
|
||||
{
|
||||
kid: key_id
|
||||
}
|
||||
)
|
||||
puts token
|
||||
```
|
||||
|
||||
1. Edit the `secret_gen.rb` file:
|
||||
|
||||
- `key_file` = "Path to the private key you downloaded from Apple". It should look like this: `AuthKey_XXXXXXXXXX.p8`.
|
||||
- `team_id` = "Your Team ID". This is found at the top right of the Apple Developer site (next to your name).
|
||||
- `client_id` = "The Service ID of the service you created". This is the `Services ID` you created in the above step `Obtain a Services ID`. If you've lost this ID, you can find it in the Apple Developer Site:
|
||||
- Go to `Certificates, Identifiers & Profiles`.
|
||||
- Click `Identifiers` at the left.
|
||||
- At the top right drop-down, select `Services IDs`.
|
||||
- Find your Identifier in the list (i.e. app.com.acme.roadrunner).
|
||||
- `key_id` = "The Key ID of the private key". This can be found in the name of your downloaded secret file (For a file named `AuthKey_XXXXXXXXXX.p8` your key_id is `XXXXXXXXXX`). If you've lost this ID, you can find it in the Apple Developer Site:
|
||||
- Go to `Certificates, Identifiers & Profiles`.
|
||||
- Click `Keys` at the left.
|
||||
- Click on your newly-created key in the list.
|
||||
- Look under `Key ID` to find your key_id.
|
||||
|
||||
2. From the command line, run: `ruby secret_gen.rb > client_secret.txt`.
|
||||
3. Your `client_secret` is now stored in this `client_secret.txt` file.
|
||||
|
||||
## Add your OAuth credentials to Supabase
|
||||
|
||||
- Go to your [Supabase Dashboard](https://app.supabase.com).
|
||||
- In the left sidebar, click the `Authentication` icon (near the top).
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page.
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important).
|
||||
- Under `External OAuth Providers` turn `Apple Enabled` to ON.
|
||||
- Enter your `client_id` and `client_secret` saved in the previous steps.
|
||||
- Click `Save`.
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `apple` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithApple() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'apple',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Apple Developer Account](https://developer.apple.com).
|
||||
- [Ruby](https://www.ruby-lang.org/en/) Docs.
|
||||
- [ruby-jwt](https://github.com/jwt/ruby-jwt) library.
|
||||
- Thanks to [Janak Amarasena](https://medium.com/@janakda) who did all the heavy lifting in [How to configure Sign In with Apple](https://medium.com/identity-beyond-borders/how-to-configure-sign-in-with-apple-77c61e336003).
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,103 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-azure',
|
||||
title: 'Login with Azure',
|
||||
description: 'Add Azure OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable Azure Auth for your project, you need to set up an Azure OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Azure OAuth consists of four broad steps:
|
||||
|
||||
- Create an application under Azure Active Directory.
|
||||
- Obtain a `Application (client) ID` with “Sign In with Azure” capabilities. This will be used as the `client id`.
|
||||
- Create a `Secret ID` with “Sign In with Azure” capabilities. The value of the secret will be used as the `client secret`.
|
||||
- Add the callback url of your application to the allowlist.
|
||||
|
||||
## Access your Azure Developer account
|
||||
|
||||
- Go to [portal.azure.com](https://portal.azure.com/#home).
|
||||
- Login and select "Azure Active Directory" under the list of Azure Services.
|
||||
|
||||
## Register an application
|
||||
|
||||
- Under Azure Active Directory, select "App registrations" in the side panel.
|
||||
- Select "New registration".
|
||||
- Choose a name and select your preferred option for the supported account types.
|
||||
- Specify the "Redirect URI".
|
||||
- The redirect / callback URI should look like this: `https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
- Click "Register" at the bottom of the form.
|
||||
|
||||

|
||||
|
||||
## Obtain a Client ID
|
||||
|
||||
This will serve as the `client_id` when you make API calls to authenticate the user.
|
||||
|
||||
- Once your app has been registered, the client id can be found under the [list of app registrations](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps) under the column titled "Application (client) ID".
|
||||
|
||||

|
||||
|
||||
## Obtain a Secret ID
|
||||
|
||||
This will serve as the `client_secret` when you make API calls to authenticate the user.
|
||||
|
||||
- Click on the name of the app registered above.
|
||||
- Under "Essentials", click on "Client credentials".
|
||||
- Navigate to the "Client secrets" tab and select "New client secret".
|
||||
- Enter a description and choose your preferred expiry for the secret.
|
||||
- Once the secret is generated, save the `value` (not the secret ID).
|
||||
|
||||

|
||||
|
||||
## Obtain the Tenant URL
|
||||
|
||||
This will allow your users to use your custom Azure login page when logging in.
|
||||
|
||||
- Select the Directory (Tenant) ID value.
|
||||
- The Azure Tenant URL should look like this: `https://login.microsoftonline.com/<tenant-id>`
|
||||
|
||||

|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
<Admonition type="tip">
|
||||
|
||||
Supabase Auth requires that Azure returns a valid email address. Therefore you must request the `email` scope in the `signIn` method above.
|
||||
|
||||
</Admonition>
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `azure` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithAzure() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth(
|
||||
{
|
||||
provider: 'azure',
|
||||
},
|
||||
{
|
||||
scopes: 'email',
|
||||
}
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Azure Developer Account](https://portal.azure.com)
|
||||
- [GitHub Discussion](https://github.com/supabase/gotrue/pull/54#issuecomment-757043573)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,95 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-bitbucket',
|
||||
title: 'Login with Bitbucket',
|
||||
description: 'Add Bitbucket OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable Bitbucket Auth for your project, you need to set up a BitBucket OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Bitbucket logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Bitbucket OAuth Consumer on [Bitbucket](https://bitbucket.org)
|
||||
- Add your Bitbucket OAuth Consumer keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your Bitbucket account
|
||||
|
||||
- Go to [bitbucket.org](https://bitbucket.org/).
|
||||
- Click on `Login` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Bitbucket OAuth app
|
||||
|
||||
- Click on your profile icon at the bottom left
|
||||
- Click on `All Workspaces`
|
||||
- Select a workspace and click on it to select it
|
||||
- Click on `Settings` on the left
|
||||
- Click on `OAuth consumers` on the left under `Apps and Features` (near the bottom)
|
||||
- Click `Add Consumer` at the top
|
||||
- Enter the name of your app under `Name`
|
||||
- In `Callback URL`, type the callback URL of your app
|
||||
- Check the permissions you need (Email, Read should be enough)
|
||||
- Click `Save` at the bottom
|
||||
- Click on your app name (the name of your new OAuth Consumer)
|
||||
- Copy your `Key` (`client_key`) and `Secret` (`client_secret`) codes
|
||||
|
||||
## Add your Bitbucket credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `Bitbucket Enabled` to ON
|
||||
- Enter your `client_id` and `client_secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `bitbucket` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithBitbucket() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'bitbucket',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Bitbucket Account](https://bitbucket.org)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,97 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-discord',
|
||||
title: 'Login with Discord',
|
||||
description: 'Add Discord OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable Discord Auth for your project, you need to set up a Discord Application and add the Application OAuth credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Discord logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Discord Application [Discord Developer Portal](https://discord.com/developers)
|
||||
- Add your Discord OAuth Consumer keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your Discord account
|
||||
|
||||
- Go to [discord.com](https://discord.com/).
|
||||
- Click on `Login` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
- Once logged in, go to [discord.com/developers](https://discord.com/developers).
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
In the next step you require a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Discord Application
|
||||
|
||||
- Click on `New Application` at the top right.
|
||||
- Enter the name of your application and click `Create`.
|
||||
- Click on `OAuth2` under `Settings` in the left side panel.
|
||||
- Click `Add Redirect` under `Redirects`.
|
||||
- Type or paste your `callback URL` into the `Redirects` box.
|
||||
- Click `Save Changes` at the bottom.
|
||||
- Copy your `Client ID` and `Client Secret` under `Client information`.
|
||||
|
||||
## Add your Discord credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `Discord Enabled` to ON
|
||||
- Enter your `client_id` and `client_secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `discord` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithDiscord() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'discord',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
If your user is already signed in, Discord prompts the user again for authorization.
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Discord Account](https://discord.com)
|
||||
- [Discord Developer Portal](https://discord.com/developers)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -0,0 +1,50 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
title: 'Email Templates',
|
||||
description: 'Learn how to configure the email templates on Supabase.',
|
||||
}
|
||||
|
||||
You can customize the email messages used for the authentication flows. You can edit the following email templates:
|
||||
|
||||
- Confirm signup
|
||||
- Invite user
|
||||
- Magic Link
|
||||
- Change Email Address
|
||||
- Reset Password
|
||||
|
||||
## Terminology
|
||||
|
||||
The templating system provides the following variables for use:
|
||||
|
||||
| Name | Description |
|
||||
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `{{ .ConfirmationURL }}` | Contains the confirmation URL. For example, a signup confirmation URL would look like: `https://project-ref.supabase.co/auth/v1/verify?token={{ .TokenHash }}&type=signup&redirect_to=https://example.com/path` . |
|
||||
| `{{ .Token }}` | Contains a 6-digit One-Time-Password (OTP) that can be used instead of the `{{. ConfirmationURL }}` . |
|
||||
| `{{ .TokenHash }}` | Contains a hashed version of the `{{ .Token }}`. This is useful for constructing your own email link in the email template. |
|
||||
| `{{ .SiteURL }}` | Contains your application's Site URL. This can be configured in your project's [authentication settings](https://app.supabase.com/project/_/auth/url-configuration). |
|
||||
|
||||
## Limitations
|
||||
|
||||
### Email Prefetching
|
||||
|
||||
Certain email providers may have spam detection or other security features that prefetch URL links from incoming emails.
|
||||
In this scenario, the `{{ .ConfirmationURL }}` sent will be consumed instantly which leads to a "Token has expired or is invalid" error.
|
||||
To guard against this:
|
||||
|
||||
- Use an email OTP instead by including `{{ .Token }}` in the email template.
|
||||
- Create your own custom email link to redirect the user to a page where they can click on a button to confirm the action.
|
||||
For example, you can include the following in your email template:
|
||||
|
||||
```html
|
||||
<a href="{{ .SiteURL }}/confirm-signup?confirmation_url={{ .ConfirmationURL }}"
|
||||
>Confirm your signup
|
||||
</a>
|
||||
```
|
||||
|
||||
The user should be brought to a page on your site where they can confirm the action by clicking a button.
|
||||
The button should contain the actual confirmation link which can be obtained from parsing the `confirmation_url={{ .ConfirmationURL }}` query parameter in the URL.
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,112 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-facebook',
|
||||
title: 'Login with Facebook',
|
||||
description: 'Add Facebook OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable Facebook Auth for your project, you need to set up a Facebook OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Facebook logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Facebook Application on the [Facebook Developers Site](https://developers.facebook.com)
|
||||
- Add your Facebook keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your Facebook Developer account
|
||||
|
||||
- Go to [developers.facebook.com](https://developers.facebook.com).
|
||||
- Click on `Log In` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Create a Facebook App
|
||||
|
||||
- Click on `My Apps` at the top right.
|
||||
- Click `Create App` near the top right.
|
||||
- Select your app type and click `Continue`.
|
||||
- Fill in your app information, then click `Create App`.
|
||||
- This should bring you to the screen: `Add Products to Your App`. (Alternatively you can click on `Add Product` in the left sidebar to get to this screen.)
|
||||
|
||||
## Find your callback URI
|
||||
|
||||
The next step requires a callback URI, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Set up FaceBook Login for your Facebook App
|
||||
|
||||
From the `Add Products to your App` screen:
|
||||
|
||||
- Click `Setup` under `Facebook Login`
|
||||
- Skip the Quickstart screen, instead, in the left sidebar, click `Settings` under `Facebook Login`
|
||||
- Enter your callback URI under `Valid OAuth Redirect URIs` on the `Facebook Login Settings` page
|
||||
- Enter this in the `Valid OAuth Redirect URIs` box
|
||||
- Click `Save Changes` at the bottom right
|
||||
|
||||
Be aware that you have to set the right access levels on your Facebook App to enable 3rd party applications to read the email address.
|
||||
From the `App Review -> Permissions and Features` screen:
|
||||
|
||||
- Click the button `Request Advanced Access` on the right side of `public_profile` and `email`
|
||||
|
||||
You can read more about access levels [here](https://developers.facebook.com/docs/graph-api/overview/access-levels/)
|
||||
|
||||
## Copy your Facebook App ID and Secret
|
||||
|
||||
- Click `Settings / Basic` in the left sidebar
|
||||
- Copy your App ID from the top of the `Basic Settings` page
|
||||
- Under `App Secret` click `Show` then copy your secret
|
||||
- Make sure all required fields are completed on this screen.
|
||||
|
||||
## Enter your Facebook App ID and Secret into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `Facebook Enabled` to ON
|
||||
- Enter your `Facebook client ID` and `Facebook secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `facebook` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithFacebook() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'facebook',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Facebook Developers Dashboard](https://developers.facebook.com/)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,105 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-github',
|
||||
title: 'Login with GitHub',
|
||||
description: 'Add GitHub OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable GitHub Auth for your project, you need to set up a GitHub OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up GitHub logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a GitHub OAuth App on [GitHub](https://github.com)
|
||||
- Add your GitHub OAuth keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your GitHub account
|
||||
|
||||
- Go to [github.com](https://github.com).
|
||||
- Click on `Sign In` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Create a GitHub Oauth App
|
||||
|
||||
Go to the [GitHub Developer Settings](https://github.com/settings/developers) page:
|
||||
|
||||
- Click on your profile photo at the top right
|
||||
- Click Settings near the bottom of the menu
|
||||
- In the left sidebar, click `Developer settings` (near the bottom)
|
||||
- In the left sidebar, click `OAuth Apps`
|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Register a new OAuth application
|
||||
|
||||
- Click `Register a new application`. If you've created an app before, click `New OAuth App` here.
|
||||
- In `Application name`, type the name of your app.
|
||||
- In `Homepage URL`, type the full URL to your app's website.
|
||||
- In `Authorization callback URL`, type the callback URL of your app.
|
||||
- Enter the URL in the `Valid OAuth Redirect URIs` box.
|
||||
- Click `Save Changes` at the bottom right.
|
||||
- Click `Register Application`.
|
||||
|
||||
Copy your new OAuth credentials
|
||||
|
||||
- Copy and save your `Client ID`.
|
||||
- Click `Generate a new client secret`.
|
||||
- Copy and save your `Client secret`.
|
||||
|
||||
## Enter your GitHub credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `GitHub Enabled` to ON
|
||||
- Enter your `GitHub Client ID` and `GitHub Client Secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `github` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithGitHub() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'github',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [GitHub Developer Settings](https://github.com/settings/developers)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,92 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-gitlab',
|
||||
title: 'Login with GitLab',
|
||||
description: 'Add GitLab OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable GitLab Auth for your project, you need to set up a GitLab OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up GitLab logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a GitLab Application on [GitLab](https://gitlab.com)
|
||||
- Add your GitLab Application keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your GitLab account
|
||||
|
||||
- Go to [gitlab.com](https://gitlab.com).
|
||||
- Click on `Login` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create your GitLab Application
|
||||
|
||||
- Click on your `profile logo` (avatar) in the top-right corner.
|
||||
- Select `Edit profile`.
|
||||
- In the left sidebar, select Applications.
|
||||
- Enter the name of the application.
|
||||
- In the `Redirect URI` box, type the callback URL of your app.
|
||||
- Check the box next to `Confidential` (make sure it is checked).
|
||||
- Check the scope named `read_user` (this is the only required scope).
|
||||
- Click `Save Application` at the bottom.
|
||||
- Copy and save your `Application ID` (`client_id`) and `Secret` (`client_secret`) which you'll need later.
|
||||
|
||||
## Add your GitLab credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- In the left sidebar, click the `Authentication` icon (near the top).
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page.
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important).
|
||||
- Under `External OAuth Providers` turn `GitLab Enabled` to ON.
|
||||
- Enter your `client_id` and `client_secret` saved in the previous step.
|
||||
- Click `Save`.
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `gitlab` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithGitLab() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'gitlab',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [GitLab Account](https://gitlab.com)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,120 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-google',
|
||||
title: 'Login with Google',
|
||||
description: 'Add Google OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable Google Auth for your project, you need to set up a Google OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Google logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Google Project on the [Google Cloud Platform Console](https://console.cloud.google.com/home/dashboard)
|
||||
- Add your Google OAuth keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your Google Cloud Platform account
|
||||
|
||||
- Go to [cloud.google.com](https://cloud.google.com).
|
||||
- Click on `Sign in` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Create a Google Cloud Platform Project
|
||||
|
||||
- Click on `Select a Project` at the top left.
|
||||
- (Or, if a project is currently selected, click on the current project name at the top left.)
|
||||
- Click `New Project` at the top right.
|
||||
- Fill in your app information, then click `Create`.
|
||||
- (This can take a few minutes.)
|
||||
- This should bring you to the dashboard for your new project.
|
||||
|
||||
## Create the OAuth Keys for your project
|
||||
|
||||
From your project's dashboard screen:
|
||||
|
||||
- In the search bar at the top labeled `Search products and resources` type `OAuth`.
|
||||
- Click on `OAuth consent screen` from the list of results.
|
||||
- On the `OAuth consent screen` page select `External`.
|
||||
- Click `Create`.
|
||||
|
||||
## Edit your app information
|
||||
|
||||
- On the `Edit app registration` page fill out your app information.
|
||||
- Click `Save and continue` at the bottom.
|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create your Google credentials
|
||||
|
||||
- Click `Credentials` at the left to go to the `Credentials` page on the Google Cloud Platform console.
|
||||
- Click `Create Credentials` near the top then select `OAuth client ID`
|
||||
- On the `Create OAuth client ID` page, select your application type. If you're not sure, choose `Web application`.
|
||||
- Fill in your app name.
|
||||
- At the bottom, under `Authorized redirect URIs` click `Add URI`.
|
||||
- Enter your callback URI under `Authorized redirect URIs` at the bottom.
|
||||
- Enter your callback URI in the `Valid OAuth Redirect URIs` box.
|
||||
- Click `Save Changes` at the bottom right.
|
||||
- Click `Create`.
|
||||
|
||||
Copy your new OAuth credentials
|
||||
|
||||
- A box will appear called `OAuth client created`.
|
||||
- Copy and save the values under `Your Client ID` and `Your Client Secret`.
|
||||
|
||||
## Enter your Google credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `Google Enabled` to ON
|
||||
- Enter your `Google Client ID` and `Google Client Secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `google` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithGoogle() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'google',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Google Cloud Platform Console](https://console.cloud.google.com/home/dashboard)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -34,7 +34,10 @@ Pass `supabaseClient` from `@supabase/supabase-js` as a prop to the component.
|
||||
import { createClient } from '@supabase/supabase-js'
|
||||
import { Auth } from '@supabase/auth-ui-react'
|
||||
|
||||
const supabase = createClient('<INSERT PROJECT URL>', '<INSERT PROJECT ANON API KEY>')
|
||||
const supabase = createClient(
|
||||
'<INSERT PROJECT URL>',
|
||||
'<INSERT PROJECT ANON API KEY>'
|
||||
)
|
||||
|
||||
const App = () => <Auth supabaseClient={supabase} />
|
||||
```
|
||||
@@ -43,13 +46,18 @@ This renders the Auth component without any styling.
|
||||
We recommend using one of the predefined themes to style the UI.
|
||||
Import the theme you want to use and pass it to the `appearence.theme` prop.
|
||||
|
||||
```js lines=4,11 title=/src/index.js
|
||||
```js lines=4,16 title=/src/index.js
|
||||
import {
|
||||
Auth,
|
||||
// Import predefined theme
|
||||
ThemeSupa,
|
||||
} from '@supabase/auth-ui-react'
|
||||
|
||||
const supabase = createClient(
|
||||
'<INSERT PROJECT URL>',
|
||||
'<INSERT PROJECT ANON API KEY>'
|
||||
)
|
||||
|
||||
const App = () => (
|
||||
<Auth
|
||||
supabaseClient={supabase}
|
||||
@@ -59,6 +67,28 @@ const App = () => (
|
||||
)
|
||||
```
|
||||
|
||||
### Social Providers
|
||||
|
||||
The Auth component also supports login with [offical social providers](../../auth#providers).
|
||||
|
||||
```js lines=13 title=/src/index.js
|
||||
import { createClient } from '@supabase/supabase-js'
|
||||
import { Auth, ThemeSupa } from '@supabase/auth-ui-react'
|
||||
|
||||
const supabase = createClient(
|
||||
'<INSERT PROJECT URL>',
|
||||
'<INSERT PROJECT ANON API KEY>'
|
||||
)
|
||||
|
||||
const App = () => (
|
||||
<Auth
|
||||
supabaseClient={supabase}
|
||||
appearance={{ theme: ThemeSupa }}
|
||||
providers={['google', 'facebook', 'twitter']}
|
||||
/>
|
||||
)
|
||||
```
|
||||
|
||||
## Customization
|
||||
|
||||
There are several ways to customize Auth UI:
|
||||
@@ -74,11 +104,14 @@ There are several ways to customize Auth UI:
|
||||
|
||||
Auth UI comes with several themes to customize the appearance. Each predefined theme comes with at least two variations, a `default` variation, and a `dark` variation. You can switch between these themes using the `theme` prop. Import the theme you want to use and pass it to the `appearence.theme` prop.
|
||||
|
||||
```js lines=2,10 title=/src/index.js
|
||||
```js lines=2,13 title=/src/index.js
|
||||
import { createClient } from '@supabase/supabase-js'
|
||||
import { Auth, ThemeSupa } from '@supabase/auth-ui-react'
|
||||
|
||||
const supabase = createClient('<INSERT PROJECT URL>', '<INSERT PROJECT ANON API KEY>')
|
||||
const supabase = createClient(
|
||||
'<INSERT PROJECT URL>',
|
||||
'<INSERT PROJECT ANON API KEY>'
|
||||
)
|
||||
|
||||
const App = () => (
|
||||
<Auth
|
||||
@@ -99,11 +132,14 @@ Currently there is only one predefined theme available, but we plan to add more.
|
||||
|
||||
Auth UI comes with two theme variations: `default` and `dark`. You can switch between these themes with the `theme` prop.
|
||||
|
||||
```js lines=11 title=/src/index.js
|
||||
```js lines=14 title=/src/index.js
|
||||
import { createClient } from '@supabase/supabase-js'
|
||||
import { Auth, ThemeSupa } from '@supabase/auth-ui-react'
|
||||
|
||||
const supabase = createClient('<INSERT PROJECT URL>', '<INSERT PROJECT ANON API KEY>')
|
||||
const supabase = createClient(
|
||||
'<INSERT PROJECT URL>',
|
||||
'<INSERT PROJECT ANON API KEY>'
|
||||
)
|
||||
|
||||
const App = () => (
|
||||
<Auth
|
||||
@@ -121,11 +157,14 @@ If you don't pass a value to `theme` it uses the `"default"` theme. You can pass
|
||||
|
||||
Auth UI themes can be overridden using variable tokens. See the [list of variable tokens](https://github.com/supabase-community/auth-ui/blob/main/packages/react/common/theming/Themes.tsx).
|
||||
|
||||
```js lines=11-18 title=/src/index.js
|
||||
```js lines=14-21 title=/src/index.js
|
||||
import { createClient } from '@supabase/supabase-js'
|
||||
import { Auth, ThemeSupa } from '@supabase/auth-ui-react'
|
||||
|
||||
const supabase = createClient('<INSERT PROJECT URL>', '<INSERT PROJECT ANON API KEY>')
|
||||
const supabase = createClient(
|
||||
'<INSERT PROJECT URL>',
|
||||
'<INSERT PROJECT ANON API KEY>'
|
||||
)
|
||||
|
||||
const App = () => (
|
||||
<Auth
|
||||
@@ -208,7 +247,10 @@ You can use custom CSS classes for the following elements:
|
||||
import { createClient } from '@supabase/supabase-js'
|
||||
import { Auth } from '@supabase/auth-ui-react'
|
||||
|
||||
const supabase = createClient('<INSERT PROJECT URL>', '<INSERT PROJECT ANON API KEY>')
|
||||
const supabase = createClient(
|
||||
'<INSERT PROJECT URL>',
|
||||
'<INSERT PROJECT ANON API KEY>'
|
||||
)
|
||||
|
||||
const App = () => (
|
||||
<Auth
|
||||
@@ -233,7 +275,10 @@ You can use custom CSS inline styles for the following elements:
|
||||
import { createClient } from '@supabase/supabase-js'
|
||||
import { Auth } from '@supabase/auth-ui-react'
|
||||
|
||||
const supabase = createClient('<INSERT PROJECT URL>', '<INSERT PROJECT ANON API KEY>')
|
||||
const supabase = createClient(
|
||||
'<INSERT PROJECT URL>',
|
||||
'<INSERT PROJECT ANON API KEY>'
|
||||
)
|
||||
|
||||
const App = () => (
|
||||
<Auth
|
||||
@@ -257,7 +302,10 @@ You can use custom labels with `localization.variables`. See the [list of labels
|
||||
import { createClient } from '@supabase/supabase-js'
|
||||
import { Auth } from '@supabase/auth-ui-react'
|
||||
|
||||
const supabase = createClient('<INSERT PROJECT URL>', '<INSERT PROJECT ANON API KEY>')
|
||||
const supabase = createClient(
|
||||
'<INSERT PROJECT URL>',
|
||||
'<INSERT PROJECT ANON API KEY>'
|
||||
)
|
||||
|
||||
const App = () => (
|
||||
<Auth
|
||||
|
||||
@@ -95,7 +95,7 @@ Create a new file at `/utils/supabase-browser.ts` and populate with the followin
|
||||
|
||||
```ts
|
||||
import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
|
||||
import { Database } from '../db_types'
|
||||
import { Database } from '../lib/database.types'
|
||||
|
||||
export default createBrowserSupabaseClient<Database>()
|
||||
```
|
||||
@@ -109,7 +109,7 @@ Create a new file at `/utils/supabase-server.ts` and populate with the following
|
||||
```ts title="/utils/supabase-server.ts"
|
||||
import { headers, cookies } from 'next/headers'
|
||||
import { createServerComponentSupabaseClient } from '@supabase/auth-helpers-nextjs'
|
||||
import { Database } from '../db_types'
|
||||
import { Database } from '../lib/database.types'
|
||||
|
||||
export default () =>
|
||||
createServerComponentSupabaseClient<Database>({
|
||||
@@ -139,6 +139,8 @@ Middleware runs before every route declared in the `matcher` array. Since we don
|
||||
>
|
||||
<TabPanel id="js" label="JavaScript">
|
||||
|
||||
Create a new file at `/pages/middleware.js` and populate with the following:
|
||||
|
||||
```jsx title="middleware.js"
|
||||
import { createMiddlewareSupabaseClient } from '@supabase/auth-helpers-nextjs'
|
||||
import { NextResponse } from 'next/server'
|
||||
@@ -164,6 +166,8 @@ export const config = {
|
||||
|
||||
<TabPanel id="ts" label="TypeScript">
|
||||
|
||||
Create a new file at `/middleware.ts` (a sibling of /pages) and populate with the following:
|
||||
|
||||
```tsx title="middleware.ts"
|
||||
import { createMiddlewareSupabaseClient } from '@supabase/auth-helpers-nextjs'
|
||||
import { NextResponse } from 'next/server'
|
||||
@@ -254,7 +258,7 @@ export default async function RootLayout({ children }) {
|
||||
}
|
||||
```
|
||||
|
||||
We don't want Next.js to cache this `session` value, so we need to export a `revalidate` value of `0`.
|
||||
We don't want Next.js to cache this `session` value, so we need to export a `revalidate` value of `0` in the layout file.
|
||||
|
||||
```jsx
|
||||
export const revalidate = 0
|
||||
@@ -641,7 +645,7 @@ Create a new file at `/app/realtime/posts.tsx` and populate with the following:
|
||||
'use client'
|
||||
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Database } from '../../db_types'
|
||||
import { Database } from '../lib/database.types'
|
||||
import supabase from '../../utils/supabase-browser'
|
||||
|
||||
type Post = Database['public']['Tables']['posts']['Row']
|
||||
|
||||
@@ -162,6 +162,7 @@ const supabaseClient = useSupabaseClient<Database>()
|
||||
|
||||
```tsx
|
||||
// Creating a new supabase server client object (e.g. in API route):
|
||||
import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'
|
||||
import type { NextApiRequest, NextApiResponse } from 'next'
|
||||
import type { Database } from 'types_db'
|
||||
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-keycloak',
|
||||
title: 'Login with Keycloak',
|
||||
description: 'Add Keycloak OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable Keycloak Auth for your project, you need to set up an Keycloak OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
To get started with Keycloak, you can run it in a docker container with: `docker run -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -p 8080:8080 jboss/keycloak:latest`
|
||||
|
||||
This guide will be assuming that you are running keycloak in a docker container as described in the command above.
|
||||
|
||||
Keycloak OAuth consists of five broad steps:
|
||||
|
||||
- Create a new client in your specified keycloak realm.
|
||||
- Obtain the `issuer` from the "OpenID Endpoint Configuration". This will be used as the `Keycloak URL`.
|
||||
- Ensure that the new client has the "Client Protocol" set to "openid-connect" and the "Access Type" is set to "confidential".
|
||||
- The `Client ID` of the client created will be used as the `client id`.
|
||||
- Obtain the `Secret` from the credentials tab which will be used as the `client secret`.
|
||||
- Add the callback url of your application to your allowlist.
|
||||
|
||||
## Access your Keycloak Admin console
|
||||
|
||||
- Login by visiting [`http://localhost:8080`](http://localhost:8080) and clicking on "Administration Console".
|
||||
|
||||
## Create a Keycloak Realm
|
||||
|
||||
- Once you've logged in to the Keycloak console, you can add a realm from the side panel. The default realm should be named "Master".
|
||||
- After you've added a new realm, you can retrieve the `issuer` from the "OpenID Endpoint Configuration" endpoint. The `issuer` will be used as the `Keycloak URL`.
|
||||
- You can find this endpoint from the realm settings under the "General Tab" or visit [`http://localhost:8080/realms/my_realm_name/.well-known/openid-configuration`](http://localhost:8080/realms/my_realm_name/.well-known/openid-configuration)
|
||||
|
||||

|
||||
|
||||
## Create a Keycloak Client
|
||||
|
||||
The "Client ID" of the created client will serve as the `client_id` when you make API calls to authenticate the user.
|
||||
|
||||

|
||||
|
||||
## Client Settings
|
||||
|
||||
After you've created the client successfully, ensure that you set the following settings:
|
||||
|
||||
1. The "Client Protocol" should be set to "openid-connect".
|
||||
2. The "Access Type" should be set to "confidential".
|
||||
3. The "Valid Redirect URIs" should be set to: `https://<project-ref>.supabase.co/auth/v1/callback`.
|
||||
|
||||

|
||||

|
||||
|
||||
## Obtain the Client Secret
|
||||
|
||||
This will serve as the `client_secret` when you make API calls to authenticate the user.
|
||||
Under the "Credentials" tab, the `Secret` value will be used as the `client secret`.
|
||||
|
||||

|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `keycloak` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithKeycloak() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'keycloak',
|
||||
options: {
|
||||
scopes: 'openid',
|
||||
},
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- You can find the keycloak openid endpoint configuration under the realm settings.
|
||||

|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,91 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-linkedin',
|
||||
title: 'Login with LinkedIn',
|
||||
description: 'Add LinkedIn OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable LinkedIn Auth for your project, you need to set up a LinkedIn OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up LinkedIn logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a LinkedIn Project and App on the [LinkedIn Developer Dashboard](https://www.linkedin.com/developers/apps).
|
||||
- Add your LinkedIn `client_id` and `client_secret` to your [Supabase Project](https://app.supabase.com).
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js).
|
||||
|
||||
## Access your LinkedIn Developer account
|
||||
|
||||
- Go to [LinkedIn Developer Dashboard](https://www.linkedin.com/developers/apps).
|
||||
- Log in (if necessary.)
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a LinkedIn OAuth app
|
||||
|
||||
- Go to [LinkedIn Developer Dashboard](https://www.linkedin.com/developers/apps).
|
||||
- Click on `Create App` at the top right
|
||||
- Enter your `LinkedIn Page` and `App Logo`
|
||||
- Save your app
|
||||
- Click `Auth` from the top menu
|
||||
- Add your `Redirect URL` to the `Authorized Redirect URLs for your app` section
|
||||
- Copy and save your newly-generated `Client ID`
|
||||
- Copy and save your newly-generated `Client Secret`
|
||||
|
||||
## Enter your LinkedIn credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- In the left sidebar, click the `Authentication` icon (near the top).
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page.
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important).
|
||||
- Under `External OAuth Providers` turn `LinkedIn Enabled` to ON.
|
||||
- Enter your `client_id` and `client_secret` saved in the previous step.
|
||||
- Click `Save`.
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `linkedin` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithLinkedIn() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'linkedin',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [LinkedIn Developer Dashboard](https://api.LinkedIn.com/apps)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -30,13 +30,15 @@ Setting up Magic Link logins for your Supabase application.
|
||||
defaultActiveId="js"
|
||||
>
|
||||
<TabPanel id="js" label="JavaScript">
|
||||
|
||||
When your user signs in, call [signInWithOtp()](/docs/reference/javascript/auth-signinwithotp) with their email address:
|
||||
|
||||
```js
|
||||
async function signInWithEmail() {
|
||||
const { data, error } = await supabase.auth.signInWithOtp({
|
||||
email: 'example@email.com',
|
||||
options: {
|
||||
emailRedirectTo: 'https://example.com/welcome',
|
||||
},
|
||||
})
|
||||
}
|
||||
```
|
||||
@@ -62,7 +64,6 @@ Future<void> signInWithEmail() async {
|
||||
defaultActiveId="js"
|
||||
>
|
||||
<TabPanel id="js" label="JavaScript">
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-notion',
|
||||
title: 'Login with Notion',
|
||||
description: 'Add Notion OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable Notion Auth for your project, you need to set up a Notion Application and add the Application OAuth credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Notion logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Notion Application [Notion Developer Portal](https://www.notion.so/my-integrations)
|
||||
- Retrieve your OAuth client ID and OAuth client secret and add them to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Create your notion integration
|
||||
|
||||
- Go to [developers.notion.com](https://developers.notion.com/).
|
||||
- Click "View my integrations" and login.
|
||||
|
||||

|
||||
|
||||
- Once logged in, go to [notion.so/my-integrations](https://notion.so/my-integrations) and create a new integration.
|
||||
- When creating your integration, ensure that you select "Public integration" under "Integration type" and "Read user information including email addresses" under "Capabilities".
|
||||
- You will need to add a redirect uri, see [Add the redirect uri](#add-the-redirect-uri)
|
||||
- Once you've filled in the necessary fields, click "Submit" to finish creating the integration.
|
||||
|
||||

|
||||
|
||||
## Add the redirect URI
|
||||
|
||||
- After selecting "Public integration", you should see an option to add "Redirect URIs".
|
||||
|
||||

|
||||
|
||||
You can retrieve the redirect uri with the following steps:
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
Your redirect uri should look like the following: `https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Add your Notion credentials into your Supabase Project
|
||||
|
||||
- Once you've created your notion integration, you should be able to retrieve the "OAuth client ID" and "OAuth client secret" from the "OAuth Domain and URIs" tab.
|
||||
|
||||

|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Under `External OAuth Providers` turn `Notion Enabled` to ON
|
||||
- Enter the "OAuth client ID" and "OAuth client secret" obtained in the `client id` and `client secret` fields.
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `notion` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithNotion() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'notion',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Notion Account](https://notion.so)
|
||||
- [Notion Developer Portal](https://www.notion.so/my-integrations)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,104 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-slack',
|
||||
title: 'Login with Slack',
|
||||
description: 'Add Slack OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable Slack Auth for your project, you need to set up a Slack OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Slack logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Slack Project and App on the [Slack Developer Dashboard](https://api.slack.com/apps).
|
||||
- Add your Slack `API Key` and `API Secret Key` to your [Supabase Project](https://app.supabase.com).
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js).
|
||||
|
||||
## Access your Slack Developer account
|
||||
|
||||
- Go to [api.slack.com](https://api.slack.com/apps).
|
||||
- Click on `Your Apps` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Slack OAuth app
|
||||
|
||||
- Go to [api.slack.com](https://api.slack.com/apps).
|
||||
- Click on `Create an App`
|
||||
|
||||
Under `Create an app...`:
|
||||
|
||||
- Click `From scratch`
|
||||
- Type the name of your app
|
||||
- Select your `Slack Workspace`
|
||||
- Click `Create App`
|
||||
|
||||
Under `App Credentials`:
|
||||
|
||||
- Copy and save your newly-generated `Client ID`
|
||||
- Copy and save your newly-generated `Client Secret`
|
||||
- Click `Permissions`
|
||||
|
||||
Under `Redirect URLs`:
|
||||
|
||||
- Click `Add New Redirect URL`
|
||||
- Paste your `Callback URL` then click `Add`
|
||||
- Click `Save URLs`
|
||||
|
||||
## Enter your Slack credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- In the left sidebar, click the `Authentication` icon (near the top).
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page.
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important).
|
||||
- Under `External OAuth Providers` turn `Slack Enabled` to ON.
|
||||
- Enter your `Client ID` (`client_id`) and `Client Secret` (`client_secret`) saved in the previous step.
|
||||
- Click `Save`.
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `slack` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithSlack() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'slack',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Slack Developer Dashboard](https://api.slack.com/apps)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,99 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-spotify',
|
||||
title: 'Login with Spotify',
|
||||
description: 'Add Spotify OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable Spotify Auth for your project, you need to set up a Spotify OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Spotify logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Spotify Project and App on the [Spotify Developer Dashboard](https://developer.spotify.com/dashboard/).
|
||||
- Add your Spotify `API Key` and `API Secret Key` to your [Supabase Project](https://app.supabase.com).
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js).
|
||||
|
||||
## Access your Spotify Developer account
|
||||
|
||||
- Log into [Spotify](https://spotify.com)
|
||||
- Access the [Spotify Developer Dashboard](https://developer.spotify.com/dashboard)
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Spotify OAuth app
|
||||
|
||||
- Log into [Spotify](https://spotify.com).
|
||||
- Go to the [Spotify Developer Dashboard](https://developer.spotify.com/dashboard)
|
||||
- Click `Create an App`
|
||||
- Type your `App name`
|
||||
- Type your `App description`
|
||||
- Check the box to agree with the `Developer TOS and Branding Guidelines`
|
||||
- Click `Create`
|
||||
- Save your `Client ID`
|
||||
- Save your `Client Secret`
|
||||
- Click `Edit Settings`
|
||||
|
||||
Under `Redirect URIs`:
|
||||
|
||||
- Paste your Supabase Callback URL in the box
|
||||
- Click `Add`
|
||||
- Click `Save` at the bottom
|
||||
|
||||
## Enter your Spotify credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- In the left sidebar, click the `Authentication` icon (near the top).
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page.
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important).
|
||||
- Under `External OAuth Providers` turn `Spotify Enabled` to ON.
|
||||
- Enter your `Client ID` (`client_id`) and `Client Secret` (`client_secret`) saved in the previous step.
|
||||
- Click `Save`.
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `spotify` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithSpotify() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'spotify',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Spotify Developer Dashboard](https://developer.spotify.com/dashboard/)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,111 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-twitch',
|
||||
title: 'Login with Twitch',
|
||||
description: 'Add Twitch OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable Twitch Auth for your project, you need to set up a Twitch Application and add the Application OAuth credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Twitch logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Twitch Application [Twitch Developer Console](https://dev.twitch.tv/console)
|
||||
- Add your Twitch OAuth Consumer keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your Twitch Developer account
|
||||
|
||||
- Go to [dev.twitch.tv](https://dev.twitch.tv).
|
||||
- Click on `Log in with Twitch` at the top right to log in.
|
||||
- If you have not already enabled 2-Factor Authentication for your Twitch Account, you will need to do that at [Twitch Security Settings](https://www.twitch.tv/settings/security) before you can continue.
|
||||
|
||||

|
||||
|
||||
- Once logged in, go to the [Twitch Developer Console](https://dev.twitch.tv/console).
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
In the next step you require a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Twitch Application
|
||||
|
||||

|
||||
|
||||
- Click on `+ Register Your Application` at the top right.
|
||||
|
||||

|
||||
|
||||
- Enter the name of your application.
|
||||
- Type or paste your `OAuth Redirect URL` (the callback URL from the previous step.)
|
||||
- Select a category for your app.
|
||||
- Check the Captcha box and click `Create`.
|
||||
|
||||
## Retrieve your Twitch OAuth Client ID and Client Secret
|
||||
|
||||
- Click `Manage` at the right of your application entry in the list.
|
||||
|
||||

|
||||
|
||||
- Copy your Client ID.
|
||||
- Click `New Secret` to create a new Client Secret.
|
||||
- Copy your Client Secret.
|
||||
|
||||

|
||||
|
||||
## Add your Twitch credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `Twitch Enabled` to ON
|
||||
- Enter your `client_id` and `client_secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `twitch` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithTwitch() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'twitch',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Twitch Account](https://twitch.tv)
|
||||
- [Twitch Developer Console](https://dev.twitch.tv/console)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,100 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-twitter',
|
||||
title: 'Login with Twitter',
|
||||
description: 'Add Twitter OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable Twitter Auth for your project, you need to set up a Twitter OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Twitter logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Twitter Project and App on the [Twitter Developer Dashboard](https://developer.twitter.com/en/portal/dashboard).
|
||||
- Add your Twitter `API Key` and `API Secret Key` to your [Supabase Project](https://app.supabase.com).
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js).
|
||||
|
||||
## Access your Twitter Developer account
|
||||
|
||||
- Go to [developer.twitter.com](https://developer.twitter.com).
|
||||
- Click on `Sign in` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Twitter OAuth app
|
||||
|
||||
- Click `+ Create Project`.
|
||||
- Enter your project name, click `Next`.
|
||||
- Select your use case, click `Next`.
|
||||
- Enter a description for your project, click `Next`.
|
||||
- Enter a name for your app, click `Complete`.
|
||||
- Copy and save your `API Key` (this is your `client_id`).
|
||||
- Copy and save your `API Secret Key` (this is your `client_secret`).
|
||||
- At the bottom, under `Next, setup your App` click the link `enable 3rd party authentication`.
|
||||
- Under `App Settings`, click on the gear icon next to your app name to go to `App Settings`.
|
||||
- At the bottom, next to `Authentication settings`, click `Edit`.
|
||||
- Turn `Enable 3-legged OAuth` ON.
|
||||
- Turn `Request email address from users` ON.
|
||||
- Enter your `Callback URL`.
|
||||
- Enter your `Website URL`.
|
||||
- Enter your `Terms of service URL`.
|
||||
- Enter your `Privacy policy URL`.
|
||||
- Click `Save`.
|
||||
|
||||
## Enter your Twitter credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- In the left sidebar, click the `Authentication` icon (near the top).
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page.
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important).
|
||||
- Under `External OAuth Providers` turn `Twitter Enabled` to ON.
|
||||
- Enter your `API Key` (`client_id`) and `API Secret Key` (`client_secret`) saved in the previous step.
|
||||
- Click `Save`.
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `twitter` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithTwitter() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'twitter',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Twitter Developer Dashboard](https://developer.twitter.com/en/portal/dashboard)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,93 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-workos',
|
||||
title: 'Login with WorkOS',
|
||||
description: 'Add WorkOS OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable WorkOS Auth for your project, you need to set up WorkOS OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
In this guide, we will cover how to use Supabase OAuth with WorkOS to implement Single-Sign-On(SSO).
|
||||
|
||||
The procedure consists of five broad steps:
|
||||
|
||||
- Create a new organization from your WorkOS Dashboard.
|
||||
- Obtain the `Client ID` from the Configuration tab and configure redirect URI.
|
||||
- Obtain the `WorkOS Secret` from the credentials tab.
|
||||
- Connect a WorkOS Supported Identity Provider
|
||||
- Add your WorkOS credentials into your Supabase project
|
||||
|
||||
## Create a WorkOS Organization
|
||||
|
||||
Log in to the dashboard and hop over to the Organizations tab to create and organization
|
||||

|
||||
|
||||
## Obtain the Client ID and configure Redirect URI
|
||||
|
||||
Head over to the Configuration tab and configure the redirect URI.The redirect URI should look like `https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
Note that this is distinct from the redirect URI referred to in the Supabase dashboard
|
||||
|
||||

|
||||
|
||||
## Obtain the WorkOS Secret
|
||||
|
||||
Head over to the API Keys page and obtain the secret key.
|
||||
|
||||

|
||||
|
||||
## Connect a WorkOS Supported Identity Provider
|
||||
|
||||
Set up the identity provider by visiting the setup link.
|
||||
|
||||

|
||||
|
||||
You can pick between any one of the many identity providers that WorkOS supports.
|
||||
|
||||
## Add your WorkOS credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Under `External OAuth Providers` turn `WorkOS Enabled` to ON
|
||||
- Enter the `Client ID`, `Secret`, and `WorkOS URL` saved in the previous steps. The ``WorkOS URL` setting should be set to https://api.workos.com/
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `workos` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithWorkOS() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'workos',
|
||||
options: {
|
||||
queryParams: {
|
||||
connection: '<your_connection>',
|
||||
organization: '<your_organization',
|
||||
provider: '<your_provider>',
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
Refer to the [WorkOS Documentation](https://workos.com/docs/reference/sso/authorize/) to learn more about the different methods.
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [WorkOS Documentation](https://workos.com/docs/sso/guide)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,100 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-zoom',
|
||||
title: 'Login with Zoom',
|
||||
description: 'Add Zoom OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
To enable Zoom Auth for your project, you need to set up a Zoom OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Zoom logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Zoom OAuth App on [Zoom App Marketplace](https://marketplace.zoom.us/)
|
||||
- Add your Zoom OAuth keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your Zoom Developer account
|
||||
|
||||
- Go to [marketplace.zoom.us](https://marketplace.zoom.us/).
|
||||
- Click on `Sign In` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Zoom Oauth App
|
||||
|
||||
- Go to [marketplace.zoom.us](https://marketplace.zoom.us/).
|
||||
- Click on `Sign In` at the top right to log in.
|
||||
- Click `Build App` (from the dropdown Develop)
|
||||
- In the OAuth card, click `Create`
|
||||
- Type the name of your app
|
||||
- Choose app type
|
||||
- Click `Create`
|
||||
|
||||
Under `App credentials`
|
||||
|
||||
- Copy and save your `Client ID`.
|
||||
- Copy and save your `Client secret`.
|
||||
|
||||
Under `Redirect URL for OAuth`
|
||||
|
||||
- Paste your `Callback URL`
|
||||
- Click `Continue`
|
||||
|
||||
## Enter your Zoom credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `Zoom Enabled` to ON
|
||||
- Enter your `Zoom Client ID` and `Zoom Client Secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `zoom` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithZoom() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'zoom',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Zoom App Marketplace](https://marketplace.zoom.us/)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -18,7 +18,7 @@ For example, a `public.profiles` table might look like this:
|
||||
|
||||
```sql
|
||||
create table public.profiles (
|
||||
id uuid references auth.users not null,
|
||||
id uuid references auth.users not null on delete cascade,
|
||||
first_name text,
|
||||
last_name text,
|
||||
|
||||
@@ -28,6 +28,12 @@ create table public.profiles (
|
||||
alter table public.profiles enable row level security;
|
||||
```
|
||||
|
||||
<Admonition type="note">
|
||||
|
||||
Make sure to specify the `on delete cascade` clause when referencing `auth.users`. Omitting it may cause problems when deleting users.
|
||||
|
||||
</Admonition>
|
||||
|
||||
## Public access
|
||||
|
||||
Since Row Level Security is enabled, this table is accessible via the API but no data will be returned unless we set up some Policies.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import OldContent from '~/pages/guides/auth.mdx'
|
||||
import NewContent from '~/pages/new/auth.mdx'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth',
|
||||
@@ -8,9 +9,175 @@ export const meta = {
|
||||
sidebar_label: 'Overview',
|
||||
}
|
||||
|
||||
## Overview
|
||||
|
||||
There are two parts to every Auth system:
|
||||
|
||||
- **Authentication:** should this person be allowed in? If yes, who are they?
|
||||
- **Authorization:** once they are in, what are they allowed to do?
|
||||
|
||||
Supabase Auth is designed to work either as a standalone product, or deeply integrated with the other Supabase products.
|
||||
Postgres is at the heart of everything we do, and the Auth system follows this principle. We leverage Postgres' built-in Auth functionality wherever possible.
|
||||
|
||||
Here's a quick, 2 minute tour of the Auth features built-in to Supabase:
|
||||
|
||||
<div className="video-container">
|
||||
<iframe
|
||||
src="https://www.youtube-nocookie.com/embed/6ow_jW4epf8"
|
||||
frameBorder="1"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowFullScreen
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
## Authentication
|
||||
|
||||
You can authenticate your users in several ways:
|
||||
|
||||
- Email & password.
|
||||
- Magic links (one-click logins).
|
||||
- Social providers.
|
||||
- Phone logins.
|
||||
|
||||
### Providers
|
||||
|
||||
We provide a suite of Providers and login methods, as well as [Auth helpers](/docs/guides/auth/auth-helpers/).
|
||||
|
||||
<div className="container" style={{ padding: 0 }}>
|
||||
<AuthProviders />
|
||||
</div>
|
||||
|
||||
### Configure third-party providers
|
||||
|
||||
You can enable third-party providers with the click of a button by navigating to Authentication > Settings > Auth Providers and inputting your `Client ID` and `Secret` for each.
|
||||
|
||||

|
||||
|
||||
### Redirect URLs and wildcards
|
||||
|
||||
When using third-party providers, the [Supabase client library](/docs/reference/javascript/auth-signinwithoauth#sign-in-using-a-third-party-provider-with-redirect) redirects the user to the provider. When the third-party provider successfully authenticates the user, the provider redirects the user to the Supabase Auth callback URL where they are further redirected to the URL specified in the `redirectTo` parameter. This parameter defaults to the [`SITE_URL`](/docs/reference/auth/config#site_url). You can modify the `SITE_URL` or [add additional redirect URLs](https://app.supabase.com/project/_/auth/settings).
|
||||
|
||||
You can use wildcard match patterns to support preview URLs from providers like Netlify and Vercel. See the [full list of supported patterns](https://pkg.go.dev/github.com/gobwas/glob#Compile). Use [this tool](https://www.digitalocean.com/community/tools/glob?comments=true&glob=http%3A%2F%2Flocalhost%3A3000%2F%2A%2A&matches=false&tests=http%3A%2F%2Flocalhost%3A3000&tests=http%3A%2F%2Flocalhost%3A3000%2F&tests=http%3A%2F%2Flocalhost%3A3000%2F%3Ftest%3Dtest&tests=http%3A%2F%2Flocalhost%3A3000%2Ftest-test%3Ftest%3Dtest&tests=http%3A%2F%2Flocalhost%3A3000%2Ftest%2Ftest%3Ftest%3Dtest) to test your patterns.
|
||||
|
||||
> ⚠️ WARNING: While the "globstar" (`**`) is useful for local development and preview URLs, we recommend setting the exact redirect URL path for your site URL in production.
|
||||
|
||||
#### Netlify preview URLs
|
||||
|
||||
For deployments with Netlify, set the `SITE_URL` to your official site URL. Add the following additional redirect URLs for local development and deployment previews:
|
||||
|
||||
- `http://localhost:3000/**`
|
||||
- `https://**--my_org.netlify.app/**`
|
||||
|
||||
#### Vercel preview URLs
|
||||
|
||||
For deployments with Vercel, set the `SITE_URL` to your official site URL. Add the following additional redirect URLs for local development and deployment previews:
|
||||
|
||||
- `http://localhost:3000/**`
|
||||
- `https://*-username.vercel.app/**`
|
||||
|
||||
Vercel provides an environment variable for the URL of the deployment called `NEXT_PUBLIC_VERCEL_URL`. See the [Vercel docs](https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables) for more details. You can use this variable to dynamically redirect depending on the environment:
|
||||
|
||||
```js
|
||||
const getURL = () => {
|
||||
let url =
|
||||
process?.env?.NEXT_PUBLIC_SITE_URL ?? // Set this to your site URL in production env.
|
||||
process?.env?.NEXT_PUBLIC_VERCEL_URL ?? // Automatically set by Vercel.
|
||||
'http://localhost:3000/';
|
||||
// Make sure to include `https://` when not localhost.
|
||||
url = url.includes('http') ? url : `https://${url}`;
|
||||
// Make sure to including trailing `/`.
|
||||
url = url.charAt(url.length - 1) === '/' ? url : `${url}/`;
|
||||
return url;
|
||||
};
|
||||
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'github'
|
||||
options: {
|
||||
redirectTo: getURL()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Mobile deep linking URIs
|
||||
|
||||
For mobile applications you can use deep linking URIs. For example for your `SITE_URL` you can specify something like `com.supabase://login-callback/` and for additional redirect URLs something like `com.supabase.staging://login-callback/` if needed.
|
||||
|
||||
## Authorization
|
||||
|
||||
When you need granular authorization rules, nothing beats PostgreSQL's Row Level Security (RLS).
|
||||
|
||||
Policies are PostgreSQL's rule engine. They are incredibly powerful and flexible, allowing you to write complex SQL rules which fit your unique business needs.
|
||||
|
||||
Get started with our [Row Level Security Guides](/docs/guides/auth/row-level-security).
|
||||
|
||||
### Row Level Security
|
||||
|
||||
Authentication only gets you so far. When you need granular authorization rules, nothing beats PostgreSQL's [Row Level Security (RLS)](https://www.postgresql.org/docs/current/ddl-rowsecurity.html). Supabase makes it simple to turn RLS on and off.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/rls-zoom2.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
### Policies
|
||||
|
||||
[Policies](https://www.postgresql.org/docs/current/sql-createpolicy.html) are PostgreSQL's rule engine. They are incredibly powerful and flexible, allowing you to write complex SQL rules which fit your unique business needs.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/policies-zoom2.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
With policies, your database becomes the rules engine. Instead of repetitively filtering your queries, like this ...
|
||||
|
||||
```js
|
||||
const loggedInUserId = 'd0714948'
|
||||
let { data, error } = await supabase
|
||||
.from('users')
|
||||
.select('user_id, name')
|
||||
.eq('user_id', loggedInUserId)
|
||||
|
||||
// console.log(data)
|
||||
// => { id: 'd0714948', name: 'Jane' }
|
||||
```
|
||||
|
||||
... you can simply define a rule on your database table, `auth.uid() = user_id`, and your request will return the rows which pass the rule, even when you remove the filter from your middleware:
|
||||
|
||||
```js
|
||||
let { data, error } = await supabase.from('users').select('user_id, name')
|
||||
|
||||
// console.log(data)
|
||||
// Still => { id: 'd0714948', name: 'Jane' }
|
||||
```
|
||||
|
||||
### How It Works
|
||||
|
||||
1. A user signs up. Supabase creates a new user in the `auth.users` table.
|
||||
2. Supabase returns a new JWT, which contains the user's `UUID`.
|
||||
3. Every request to your database also sends the JWT.
|
||||
4. Postgres inspects the JWT to determine the user making the request.
|
||||
5. The user's UID can be used in policies to restrict access to rows.
|
||||
|
||||
Supabase provides a special function in Postgres, `auth.uid()`, which extracts the user's UID from the JWT. This is especially useful when creating policies.
|
||||
|
||||
## User Management
|
||||
|
||||
Supabase provides multiple endpoints to authenticate and manage your users:
|
||||
|
||||
- [Sign up](/docs/reference/javascript/auth-signup)
|
||||
- [Sign in with password](/docs/reference/javascript/auth-signinwithpassword)
|
||||
- [Sign in with passwordless / one-time password (OTP)](/docs/reference/javascript/auth-signinwithotp)
|
||||
- [Sign in with OAuth](/docs/reference/javascript/auth-signinwithoauth)
|
||||
- [Sign out](/docs/reference/javascript/auth-signout)
|
||||
|
||||
When users sign up, Supabase assigns them a unique ID. You can reference this ID anywhere in your database. For example, you might create a `profiles` table referencing `id` in the `auth.users` table using a `user_id` field.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/auth-zoom2.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return OldContent()
|
||||
const router = useRouter()
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true' && !router.asPath.includes('overview')) {
|
||||
return NewContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
}
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import { IconPanel, GlassPanel, IconMail } from 'ui'
|
||||
import Link from 'next/link'
|
||||
import { PhoneLoginsItems } from '~/components/Navigation/NavigationMenu/NavigationMenu.constants'
|
||||
|
||||
export const meta = {
|
||||
title: 'Passwordless Login',
|
||||
description: 'Learn about logging in with email one-time passwords (magic links) and SMS one-time passwords.',
|
||||
}
|
||||
|
||||
Passwordless login is a method of authentication that allows users to log in to a website or application without using a password. Instead of entering a password, the user may be asked to provide some other form of authentication, such as a one-time code sent via email or SMS, or by using a biometric factor like their fingerprint or facial recognition.
|
||||
|
||||
## Benefits
|
||||
|
||||
There are several benefits of implementing passwordless login in your applications:
|
||||
|
||||
1. **Improved user experience**: By eliminating the need for users to remember and enter complex passwords, passwordless login can make it easier and more convenient for users to log in to your application. This can improve the overall user experience and make it more enjoyable for users to interact with your application.
|
||||
|
||||
2. **Increased security**: Passwordless login can improve the security of your application by reducing the risk of password-related security breaches, such as password reuse and weak passwords. By using alternative forms of authentication, such as one-time codes or biometric factors, you can make it more difficult for unauthorized users to access your application.
|
||||
|
||||
3. **Reduced support burden**: Passwordless login can also help reduce the support burden for your team by eliminating the need to reset forgotten passwords or deal with other password-related issues. This can free up your team to focus on other important tasks and improve the efficiency of your operation.
|
||||
|
||||
## Set up Passwordless Login with Supabase Auth
|
||||
|
||||
Supabase supports passwordless logins through "magic links" (instead of entering a password, the user is sent
|
||||
a link which they can click to log in to their account) and one-time passwords via SMS through several communications platforms. Follow the guides below to set up a passwordless login flow with Supabase Auth.
|
||||
|
||||
### Email One-Time Password (OTP)
|
||||
|
||||
<div className="grid grid-cols-2 gap-12">
|
||||
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-3 gap-10 not-prose py-8">
|
||||
<Link href={`/auth/auth-magic-link`} passHref>
|
||||
<a>
|
||||
<IconPanel title={'Magic Link'} span="col-span-6" icon={
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 text-gold-1000">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z" />
|
||||
</svg>
|
||||
}>
|
||||
|
||||
Implement Magic Link Login in your application
|
||||
|
||||
</IconPanel>
|
||||
</a>
|
||||
</Link>
|
||||
|
||||
</div>
|
||||
|
||||
### Phone SMS One-Time Password (OTP)
|
||||
|
||||
<div className="grid grid-cols-12 gap-10 not-prose py-8">
|
||||
{PhoneLoginsItems.map((item) => (
|
||||
<Link href={`/${item.url}`} key={item.name} passHref>
|
||||
<a className="col-span-4">
|
||||
<IconPanel
|
||||
title={item.name}
|
||||
span="col-span-6"
|
||||
icon={item.icon}
|
||||
isDarkMode={item.isDarkMode}
|
||||
>
|
||||
{item.linkDescription}
|
||||
</IconPanel>
|
||||
</a>
|
||||
</Link>
|
||||
))}
|
||||
|
||||
</div>
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,17 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-magic-link.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-magic-link',
|
||||
title: 'Login With Magic Link',
|
||||
description: 'Use Supabase to authenticate and authorize your users using magic links.',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
}
|
||||
|
||||
export default Page
|
||||
@@ -1,17 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-messagebird.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-messagebird',
|
||||
title: 'Phone Auth with MessageBird',
|
||||
description: 'How to set up and use Mobile OTP with MessageBird and Supabase.',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
}
|
||||
|
||||
export default Page
|
||||
@@ -1,17 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-twilio.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-twilio',
|
||||
title: 'Phone Auth with Twilio',
|
||||
description: 'How to set up and use Mobile OTP with Twilio and Supabase.',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
}
|
||||
|
||||
export default Page
|
||||
@@ -1,17 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-vonage.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-vonage',
|
||||
title: 'Phone Auth with Vonage',
|
||||
description: 'How to set up and use Mobile OTP with Vonage and Supabase.',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
}
|
||||
|
||||
export default Page
|
||||
@@ -0,0 +1,47 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import { IconPanel, GlassPanel, IconMail } from 'ui'
|
||||
import Link from 'next/link'
|
||||
import { PhoneLoginsItems } from '~/components/Navigation/NavigationMenu/NavigationMenu.constants'
|
||||
|
||||
export const meta = {
|
||||
title: 'Phone Login',
|
||||
description: 'Learn about logging in to your platform using SMS one-time passwords.',
|
||||
}
|
||||
|
||||
Phone Login is a method of authentication that allows users to log in to a website or application without using a password. Instead of entering a password, the user provides another form of authentication through a one-time code sent via SMS.
|
||||
|
||||
## Benefits
|
||||
|
||||
There are several reasons why you might want to add phone login to your applications:
|
||||
|
||||
- **Improved user experience**: By eliminating the need for users to remember and enter complex passwords, phone login can make it easier and more convenient for users to log in to your application. This can improve the overall user experience and make it more enjoyable for users to interact with your application.
|
||||
|
||||
- **Increased security**: Phone login can improve the security of your application by reducing the risk of password-related security breaches, such as password reuse and weak passwords. By using alternative forms of authentication, such as one-time codes or biometric factors, you can make it more difficult for unauthorized users to access your application.
|
||||
|
||||
- **Reduced support burden**: Phone login can also help reduce the support burden for your team by eliminating the need to handle password recovery flows or deal with other password-related issues. This can free up your team to focus on other important tasks and improve the efficiency of your operation.
|
||||
|
||||
## Set up a provider with Supabase Auth
|
||||
|
||||
Supabase supports Phone Login with several communications platforms. Follow the guides below to set up a provider with Supabase Auth.
|
||||
|
||||
<div className="grid grid-cols-12 gap-10 not-prose py-8">
|
||||
{PhoneLoginsItems.map((item) => (
|
||||
<Link href={`${item.url}`} key={item.name} passHref>
|
||||
<a className="col-span-4">
|
||||
<IconPanel
|
||||
title={item.name}
|
||||
span="col-span-6"
|
||||
icon={item.icon}
|
||||
isDarkMode={item.isDarkMode}
|
||||
>
|
||||
{item.linkDescription}
|
||||
</IconPanel>
|
||||
</a>
|
||||
</Link>
|
||||
))}
|
||||
|
||||
</div>
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -16,11 +16,11 @@ OAuth is commonly used for things like logging in to a social media account from
|
||||
|
||||
There are several reasons why you might want to add social login to your applications:
|
||||
|
||||
1. **Improved user experience**: Users can register and log in to your application using their existing social media accounts, which can be faster and more convenient than creating a new account from scratch. This makes it easier for users to access your application, improving their overall experience.
|
||||
- **Improved user experience**: Users can register and log in to your application using their existing social media accounts, which can be faster and more convenient than creating a new account from scratch. This makes it easier for users to access your application, improving their overall experience.
|
||||
|
||||
2. **Better user engagement**: You can access additional data and insights about your users, such as their interests, demographics, and social connections. This can help you tailor your content and marketing efforts to better engage with your users and provide a more personalized experience.
|
||||
- **Better user engagement**: You can access additional data and insights about your users, such as their interests, demographics, and social connections. This can help you tailor your content and marketing efforts to better engage with your users and provide a more personalized experience.
|
||||
|
||||
3. **Increased security**: Social login can improve the security of your application by leveraging the security measures and authentication protocols of the social media platforms that your users are logging in with. This can help protect against unauthorized access and account takeovers.
|
||||
- **Increased security**: Social login can improve the security of your application by leveraging the security measures and authentication protocols of the social media platforms that your users are logging in with. This can help protect against unauthorized access and account takeovers.
|
||||
|
||||
## Set up a social provider with Supabase Auth
|
||||
|
||||
@@ -28,7 +28,7 @@ Supabase supports a suite of social providers. Follow these guides to configure
|
||||
|
||||
<div className="grid grid-cols-12 gap-10 not-prose py-8">
|
||||
{SocialLoginItems.map((item) => (
|
||||
<Link href={`/${item.url}`} key={item.name} passHref>
|
||||
<Link href={`${item.url}`} key={item.name} passHref>
|
||||
<a className="col-span-6 lg:col-span-4 xl:col-span-3">
|
||||
<IconPanel
|
||||
title={item.name}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-apple.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-apple',
|
||||
@@ -7,11 +6,202 @@ export const meta = {
|
||||
description: 'Add Apple OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable Apple Auth for your project, you need to set up an Apple OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Apple OAuth consists of six broad steps:
|
||||
|
||||
- Obtaining an `App Id` with “Sign In with Apple” capabilities.
|
||||
- Obtaining a `Services Id` - this will serve as the `client_id`.
|
||||
- Obtaining a `secret key` that will be used to get our `client_secret`.
|
||||
- Generating the `client_secret` using the `secret key`.
|
||||
- Add your `client id` and `client secret` keys to your [Supabase Project](https://app.supabase.com).
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js).
|
||||
|
||||
## Access your Apple Developer account
|
||||
|
||||
- Go to [developer.apple.com](https://developer.apple.com).
|
||||
- Click on `Account` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Obtain an App ID
|
||||
|
||||
- Go to `Certificates, Identifiers & Profiles`.
|
||||
- Click on `Identifiers` at the left.
|
||||
- Click on the `+` sign in the upper left next to `Identifiers`.
|
||||
- Select `App IDs` and click `Continue`.
|
||||
- Select type `App` and click `Continue`.
|
||||
- Fill out your app information:
|
||||
- App description.
|
||||
- Bundle ID (Apple recommends reverse-domain name style, so if your domain is acme.com and your app is called roadrunner, use: "com.acme.roadrunner").
|
||||
- Scroll down and check `Sign In With Apple`.
|
||||
- Click `Continue` at the top right.
|
||||
- Click `Register` at the top right.
|
||||
|
||||
## Obtain a Services ID
|
||||
|
||||
This will serve as the `client_id` when you make API calls to authenticate the user.
|
||||
|
||||
- Go to `Certificates, Identifiers & Profiles`.
|
||||
- Click on `Identifiers` at the left.
|
||||
- Click on the `+` sign in the upper left next to `Identifiers`.
|
||||
- Select `Services IDs` and click `Continue`.
|
||||
- Fill out your information:
|
||||
- App description.
|
||||
- Bundle ID (you can't use the same Bundle ID from the previous step, but you can just add something to the beginning, such as "app." to make it app.com.acme.roadrunner").
|
||||
- SAVE THIS ID -- this ID will become your `client_id` later.
|
||||
- Click `Continue` at the top right.
|
||||
- Click `Register` at the top right.
|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Configure your Services ID
|
||||
|
||||
- Under `Identifiers`, click on your newly-created Services ID.
|
||||
- Check the box next to `Sign In With Apple` to enable it.
|
||||
- Click `Configure` to the right.
|
||||
- Make sure your newly created Bundle ID is selected under `Primary App ID`
|
||||
- Add your domain to the `Domains and Subdomains` box (do not add `https://`, just add the domain).
|
||||
- In the `Return URLs` box, type the callback URL of your app which you found in the previous step and click `Next` at the bottom right.
|
||||
- Click `Done` at the bottom.
|
||||
- Click `Continue` at the top right.
|
||||
- Click `Save` at the top right.
|
||||
|
||||
## Download your secret key
|
||||
|
||||
Now you'll need to download a `secret key` file from Apple that will be used to generate your `client_secret`.
|
||||
|
||||
- Go to `Certificates, Identifiers & Profiles`.
|
||||
- Click on `Keys` at the left.
|
||||
- Click on the `+` sign in the upper left next to `Keys`.
|
||||
- Enter a `Key Name`.
|
||||
- Check `Sign In with Apple`.
|
||||
- Click `Configure` to the right.
|
||||
- Select your newly-created Services ID from the dropdown selector.
|
||||
- Click `Save` at the top right.
|
||||
- Click `Continue` at the top right.
|
||||
- Click `Register` at the top right.
|
||||
- Click `Download` at the top right.
|
||||
- Save the downloaded file -- this contains your "secret key" that will be used to generate your `client_secret`.
|
||||
- Click `Done` at the top right.
|
||||
|
||||
## Generate a `client_secret`
|
||||
|
||||
The `secret key` you downloaded is used to create the `client_secret` string you'll need to authenticate your users.
|
||||
|
||||
According to the [Apple Docs](https://developer.apple.com/documentation/signinwithapplerestapi/generate_and_validate_tokens) it needs to be a JWT
|
||||
token encrypted using the Elliptic Curve Digital Signature Algorithm (ECDSA) with the P-256 curve and the SHA-256 hash algorithm.
|
||||
|
||||
At this time, the easiest way to generate this JWT token is with [Ruby](https://www.ruby-lang.org/en/).
|
||||
If you don't have Ruby installed, you can [Download Ruby Here](https://www.ruby-lang.org/en/downloads).
|
||||
|
||||
- Install Ruby (or check to make sure it's installed on your system).
|
||||
- Install [ruby-jwt](https://github.com/jwt/ruby-jwt).
|
||||
- From the command line, run: `sudo gem install jwt`.
|
||||
|
||||
Create the script below using a text editor: `secret_gen.rb`
|
||||
|
||||
```ruby
|
||||
require "jwt"
|
||||
|
||||
key_file = "Path to the private key"
|
||||
team_id = "Your Team ID"
|
||||
client_id = "The Service ID of the service you created"
|
||||
key_id = "The Key ID of the private key"
|
||||
|
||||
validity_period = 180 # In days. Max 180 (6 months) according to Apple docs.
|
||||
|
||||
private_key = OpenSSL::PKey::EC.new IO.read key_file
|
||||
|
||||
token = JWT.encode(
|
||||
{
|
||||
iss: team_id,
|
||||
iat: Time.now.to_i,
|
||||
exp: Time.now.to_i + 86400 * validity_period,
|
||||
aud: "https://appleid.apple.com",
|
||||
sub: client_id
|
||||
},
|
||||
private_key,
|
||||
"ES256",
|
||||
header_fields=
|
||||
{
|
||||
kid: key_id
|
||||
}
|
||||
)
|
||||
puts token
|
||||
```
|
||||
|
||||
1. Edit the `secret_gen.rb` file:
|
||||
|
||||
- `key_file` = "Path to the private key you downloaded from Apple". It should look like this: `AuthKey_XXXXXXXXXX.p8`.
|
||||
- `team_id` = "Your Team ID". This is found at the top right of the Apple Developer site (next to your name).
|
||||
- `client_id` = "The Service ID of the service you created". This is the `Services ID` you created in the above step `Obtain a Services ID`. If you've lost this ID, you can find it in the Apple Developer Site:
|
||||
- Go to `Certificates, Identifiers & Profiles`.
|
||||
- Click `Identifiers` at the left.
|
||||
- At the top right drop-down, select `Services IDs`.
|
||||
- Find your Identifier in the list (i.e. app.com.acme.roadrunner).
|
||||
- `key_id` = "The Key ID of the private key". This can be found in the name of your downloaded secret file (For a file named `AuthKey_XXXXXXXXXX.p8` your key_id is `XXXXXXXXXX`). If you've lost this ID, you can find it in the Apple Developer Site:
|
||||
- Go to `Certificates, Identifiers & Profiles`.
|
||||
- Click `Keys` at the left.
|
||||
- Click on your newly-created key in the list.
|
||||
- Look under `Key ID` to find your key_id.
|
||||
|
||||
2. From the command line, run: `ruby secret_gen.rb > client_secret.txt`.
|
||||
3. Your `client_secret` is now stored in this `client_secret.txt` file.
|
||||
|
||||
## Add your OAuth credentials to Supabase
|
||||
|
||||
- Go to your [Supabase Dashboard](https://app.supabase.com).
|
||||
- In the left sidebar, click the `Authentication` icon (near the top).
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page.
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important).
|
||||
- Under `External OAuth Providers` turn `Apple Enabled` to ON.
|
||||
- Enter your `client_id` and `client_secret` saved in the previous steps.
|
||||
- Click `Save`.
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `apple` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithApple() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'apple',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Apple Developer Account](https://developer.apple.com).
|
||||
- [Ruby](https://www.ruby-lang.org/en/) Docs.
|
||||
- [ruby-jwt](https://github.com/jwt/ruby-jwt) library.
|
||||
- Thanks to [Janak Amarasena](https://medium.com/@janakda) who did all the heavy lifting in [How to configure Sign In with Apple](https://medium.com/identity-beyond-borders/how-to-configure-sign-in-with-apple-77c61e336003).
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-azure.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-azure',
|
||||
@@ -7,11 +6,98 @@ export const meta = {
|
||||
description: 'Add Azure OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable Azure Auth for your project, you need to set up an Azure OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Azure OAuth consists of four broad steps:
|
||||
|
||||
- Create an application under Azure Active Directory.
|
||||
- Obtain a `Application (client) ID` with “Sign In with Azure” capabilities. This will be used as the `client id`.
|
||||
- Create a `Secret ID` with “Sign In with Azure” capabilities. The value of the secret will be used as the `client secret`.
|
||||
- Add the callback url of your application to the allowlist.
|
||||
|
||||
## Access your Azure Developer account
|
||||
|
||||
- Go to [portal.azure.com](https://portal.azure.com/#home).
|
||||
- Login and select "Azure Active Directory" under the list of Azure Services.
|
||||
|
||||
## Register an application
|
||||
|
||||
- Under Azure Active Directory, select "App registrations" in the side panel.
|
||||
- Select "New registration".
|
||||
- Choose a name and select your preferred option for the supported account types.
|
||||
- Specify the "Redirect URI".
|
||||
- The redirect / callback URI should look like this: `https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
- Click "Register" at the bottom of the form.
|
||||
|
||||

|
||||
|
||||
## Obtain a Client ID
|
||||
|
||||
This will serve as the `client_id` when you make API calls to authenticate the user.
|
||||
|
||||
- Once your app has been registered, the client id can be found under the [list of app registrations](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps) under the column titled "Application (client) ID".
|
||||
|
||||

|
||||
|
||||
## Obtain a Secret ID
|
||||
|
||||
This will serve as the `client_secret` when you make API calls to authenticate the user.
|
||||
|
||||
- Click on the name of the app registered above.
|
||||
- Under "Essentials", click on "Client credentials".
|
||||
- Navigate to the "Client secrets" tab and select "New client secret".
|
||||
- Enter a description and choose your preferred expiry for the secret.
|
||||
- Once the secret is generated, save the `value` (not the secret ID).
|
||||
|
||||

|
||||
|
||||
## Obtain the Tenant URL
|
||||
|
||||
This will allow your users to use your custom Azure login page when logging in.
|
||||
|
||||
- Select the Directory (Tenant) ID value.
|
||||
- The Azure Tenant URL should look like this: `https://login.microsoftonline.com/<tenant-id>`
|
||||
|
||||

|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
<Admonition type="tip">
|
||||
|
||||
Supabase Auth requires that Azure returns a valid email address. Therefore you must request the `email` scope in the `signIn` method above.
|
||||
|
||||
</Admonition>
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `azure` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithAzure() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth(
|
||||
{
|
||||
provider: 'azure',
|
||||
},
|
||||
{
|
||||
scopes: 'email',
|
||||
}
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Azure Developer Account](https://portal.azure.com)
|
||||
- [GitHub Discussion](https://github.com/supabase/gotrue/pull/54#issuecomment-757043573)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-bitbucket.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-bitbucket',
|
||||
@@ -7,11 +6,90 @@ export const meta = {
|
||||
description: 'Add Bitbucket OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable Bitbucket Auth for your project, you need to set up a BitBucket OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Bitbucket logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Bitbucket OAuth Consumer on [Bitbucket](https://bitbucket.org)
|
||||
- Add your Bitbucket OAuth Consumer keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your Bitbucket account
|
||||
|
||||
- Go to [bitbucket.org](https://bitbucket.org/).
|
||||
- Click on `Login` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Bitbucket OAuth app
|
||||
|
||||
- Click on your profile icon at the bottom left
|
||||
- Click on `All Workspaces`
|
||||
- Select a workspace and click on it to select it
|
||||
- Click on `Settings` on the left
|
||||
- Click on `OAuth consumers` on the left under `Apps and Features` (near the bottom)
|
||||
- Click `Add Consumer` at the top
|
||||
- Enter the name of your app under `Name`
|
||||
- In `Callback URL`, type the callback URL of your app
|
||||
- Check the permissions you need (Email, Read should be enough)
|
||||
- Click `Save` at the bottom
|
||||
- Click on your app name (the name of your new OAuth Consumer)
|
||||
- Copy your `Key` (`client_key`) and `Secret` (`client_secret`) codes
|
||||
|
||||
## Add your Bitbucket credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `Bitbucket Enabled` to ON
|
||||
- Enter your `client_id` and `client_secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `bitbucket` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithBitbucket() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'bitbucket',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Bitbucket Account](https://bitbucket.org)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-discord.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-discord',
|
||||
@@ -7,11 +6,92 @@ export const meta = {
|
||||
description: 'Add Discord OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable Discord Auth for your project, you need to set up a Discord Application and add the Application OAuth credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Discord logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Discord Application [Discord Developer Portal](https://discord.com/developers)
|
||||
- Add your Discord OAuth Consumer keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your Discord account
|
||||
|
||||
- Go to [discord.com](https://discord.com/).
|
||||
- Click on `Login` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
- Once logged in, go to [discord.com/developers](https://discord.com/developers).
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
In the next step you require a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Discord Application
|
||||
|
||||
- Click on `New Application` at the top right.
|
||||
- Enter the name of your application and click `Create`.
|
||||
- Click on `OAuth2` under `Settings` in the left side panel.
|
||||
- Click `Add Redirect` under `Redirects`.
|
||||
- Type or paste your `callback URL` into the `Redirects` box.
|
||||
- Click `Save Changes` at the bottom.
|
||||
- Copy your `Client ID` and `Client Secret` under `Client information`.
|
||||
|
||||
## Add your Discord credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `Discord Enabled` to ON
|
||||
- Enter your `client_id` and `client_secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `discord` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithDiscord() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'discord',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
If your user is already signed in, Discord prompts the user again for authorization.
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Discord Account](https://discord.com)
|
||||
- [Discord Developer Portal](https://discord.com/developers)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-facebook.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-facebook',
|
||||
@@ -7,11 +6,107 @@ export const meta = {
|
||||
description: 'Add Facebook OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable Facebook Auth for your project, you need to set up a Facebook OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Facebook logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Facebook Application on the [Facebook Developers Site](https://developers.facebook.com)
|
||||
- Add your Facebook keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your Facebook Developer account
|
||||
|
||||
- Go to [developers.facebook.com](https://developers.facebook.com).
|
||||
- Click on `Log In` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Create a Facebook App
|
||||
|
||||
- Click on `My Apps` at the top right.
|
||||
- Click `Create App` near the top right.
|
||||
- Select your app type and click `Continue`.
|
||||
- Fill in your app information, then click `Create App`.
|
||||
- This should bring you to the screen: `Add Products to Your App`. (Alternatively you can click on `Add Product` in the left sidebar to get to this screen.)
|
||||
|
||||
## Find your callback URI
|
||||
|
||||
The next step requires a callback URI, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Set up FaceBook Login for your Facebook App
|
||||
|
||||
From the `Add Products to your App` screen:
|
||||
|
||||
- Click `Setup` under `Facebook Login`
|
||||
- Skip the Quickstart screen, instead, in the left sidebar, click `Settings` under `Facebook Login`
|
||||
- Enter your callback URI under `Valid OAuth Redirect URIs` on the `Facebook Login Settings` page
|
||||
- Enter this in the `Valid OAuth Redirect URIs` box
|
||||
- Click `Save Changes` at the bottom right
|
||||
|
||||
Be aware that you have to set the right access levels on your Facebook App to enable 3rd party applications to read the email address.
|
||||
From the `App Review -> Permissions and Features` screen:
|
||||
|
||||
- Click the button `Request Advanced Access` on the right side of `public_profile` and `email`
|
||||
|
||||
You can read more about access levels [here](https://developers.facebook.com/docs/graph-api/overview/access-levels/)
|
||||
|
||||
## Copy your Facebook App ID and Secret
|
||||
|
||||
- Click `Settings / Basic` in the left sidebar
|
||||
- Copy your App ID from the top of the `Basic Settings` page
|
||||
- Under `App Secret` click `Show` then copy your secret
|
||||
- Make sure all required fields are completed on this screen.
|
||||
|
||||
## Enter your Facebook App ID and Secret into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `Facebook Enabled` to ON
|
||||
- Enter your `Facebook client ID` and `Facebook secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `facebook` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithFacebook() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'facebook',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Facebook Developers Dashboard](https://developers.facebook.com/)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-github.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-github',
|
||||
@@ -7,11 +6,100 @@ export const meta = {
|
||||
description: 'Add GitHub OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable GitHub Auth for your project, you need to set up a GitHub OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up GitHub logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a GitHub OAuth App on [GitHub](https://github.com)
|
||||
- Add your GitHub OAuth keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your GitHub account
|
||||
|
||||
- Go to [github.com](https://github.com).
|
||||
- Click on `Sign In` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Create a GitHub Oauth App
|
||||
|
||||
Go to the [GitHub Developer Settings](https://github.com/settings/developers) page:
|
||||
|
||||
- Click on your profile photo at the top right
|
||||
- Click Settings near the bottom of the menu
|
||||
- In the left sidebar, click `Developer settings` (near the bottom)
|
||||
- In the left sidebar, click `OAuth Apps`
|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Register a new OAuth application
|
||||
|
||||
- Click `Register a new application`. If you've created an app before, click `New OAuth App` here.
|
||||
- In `Application name`, type the name of your app.
|
||||
- In `Homepage URL`, type the full URL to your app's website.
|
||||
- In `Authorization callback URL`, type the callback URL of your app.
|
||||
- Enter the URL in the `Valid OAuth Redirect URIs` box.
|
||||
- Click `Save Changes` at the bottom right.
|
||||
- Click `Register Application`.
|
||||
|
||||
Copy your new OAuth credentials
|
||||
|
||||
- Copy and save your `Client ID`.
|
||||
- Click `Generate a new client secret`.
|
||||
- Copy and save your `Client secret`.
|
||||
|
||||
## Enter your GitHub credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `GitHub Enabled` to ON
|
||||
- Enter your `GitHub Client ID` and `GitHub Client Secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `github` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithGitHub() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'github',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [GitHub Developer Settings](https://github.com/settings/developers)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-gitlab.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-gitlab',
|
||||
@@ -7,11 +6,87 @@ export const meta = {
|
||||
description: 'Add GitLab OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable GitLab Auth for your project, you need to set up a GitLab OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up GitLab logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a GitLab Application on [GitLab](https://gitlab.com)
|
||||
- Add your GitLab Application keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your GitLab account
|
||||
|
||||
- Go to [gitlab.com](https://gitlab.com).
|
||||
- Click on `Login` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create your GitLab Application
|
||||
|
||||
- Click on your `profile logo` (avatar) in the top-right corner.
|
||||
- Select `Edit profile`.
|
||||
- In the left sidebar, select Applications.
|
||||
- Enter the name of the application.
|
||||
- In the `Redirect URI` box, type the callback URL of your app.
|
||||
- Check the box next to `Confidential` (make sure it is checked).
|
||||
- Check the scope named `read_user` (this is the only required scope).
|
||||
- Click `Save Application` at the bottom.
|
||||
- Copy and save your `Application ID` (`client_id`) and `Secret` (`client_secret`) which you'll need later.
|
||||
|
||||
## Add your GitLab credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- In the left sidebar, click the `Authentication` icon (near the top).
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page.
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important).
|
||||
- Under `External OAuth Providers` turn `GitLab Enabled` to ON.
|
||||
- Enter your `client_id` and `client_secret` saved in the previous step.
|
||||
- Click `Save`.
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `gitlab` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithGitLab() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'gitlab',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [GitLab Account](https://gitlab.com)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-google.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-google',
|
||||
@@ -7,11 +6,115 @@ export const meta = {
|
||||
description: 'Add Google OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable Google Auth for your project, you need to set up a Google OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Google logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Google Project on the [Google Cloud Platform Console](https://console.cloud.google.com/home/dashboard)
|
||||
- Add your Google OAuth keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your Google Cloud Platform account
|
||||
|
||||
- Go to [cloud.google.com](https://cloud.google.com).
|
||||
- Click on `Sign in` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Create a Google Cloud Platform Project
|
||||
|
||||
- Click on `Select a Project` at the top left.
|
||||
- (Or, if a project is currently selected, click on the current project name at the top left.)
|
||||
- Click `New Project` at the top right.
|
||||
- Fill in your app information, then click `Create`.
|
||||
- (This can take a few minutes.)
|
||||
- This should bring you to the dashboard for your new project.
|
||||
|
||||
## Create the OAuth Keys for your project
|
||||
|
||||
From your project's dashboard screen:
|
||||
|
||||
- In the search bar at the top labeled `Search products and resources` type `OAuth`.
|
||||
- Click on `OAuth consent screen` from the list of results.
|
||||
- On the `OAuth consent screen` page select `External`.
|
||||
- Click `Create`.
|
||||
|
||||
## Edit your app information
|
||||
|
||||
- On the `Edit app registration` page fill out your app information.
|
||||
- Click `Save and continue` at the bottom.
|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create your Google credentials
|
||||
|
||||
- Click `Credentials` at the left to go to the `Credentials` page on the Google Cloud Platform console.
|
||||
- Click `Create Credentials` near the top then select `OAuth client ID`
|
||||
- On the `Create OAuth client ID` page, select your application type. If you're not sure, choose `Web application`.
|
||||
- Fill in your app name.
|
||||
- At the bottom, under `Authorized redirect URIs` click `Add URI`.
|
||||
- Enter your callback URI under `Authorized redirect URIs` at the bottom.
|
||||
- Enter your callback URI in the `Valid OAuth Redirect URIs` box.
|
||||
- Click `Save Changes` at the bottom right.
|
||||
- Click `Create`.
|
||||
|
||||
Copy your new OAuth credentials
|
||||
|
||||
- A box will appear called `OAuth client created`.
|
||||
- Copy and save the values under `Your Client ID` and `Your Client Secret`.
|
||||
|
||||
## Enter your Google credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `Google Enabled` to ON
|
||||
- Enter your `Google Client ID` and `Google Client Secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `google` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithGoogle() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'google',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Google Cloud Platform Console](https://console.cloud.google.com/home/dashboard)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-keycloak.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-keycloak',
|
||||
@@ -7,11 +6,87 @@ export const meta = {
|
||||
description: 'Add Keycloak OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable Keycloak Auth for your project, you need to set up an Keycloak OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
To get started with Keycloak, you can run it in a docker container with: `docker run -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -p 8080:8080 jboss/keycloak:latest`
|
||||
|
||||
This guide will be assuming that you are running keycloak in a docker container as described in the command above.
|
||||
|
||||
Keycloak OAuth consists of five broad steps:
|
||||
|
||||
- Create a new client in your specified keycloak realm.
|
||||
- Obtain the `issuer` from the "OpenID Endpoint Configuration". This will be used as the `Keycloak URL`.
|
||||
- Ensure that the new client has the "Client Protocol" set to "openid-connect" and the "Access Type" is set to "confidential".
|
||||
- The `Client ID` of the client created will be used as the `client id`.
|
||||
- Obtain the `Secret` from the credentials tab which will be used as the `client secret`.
|
||||
- Add the callback url of your application to your allowlist.
|
||||
|
||||
## Access your Keycloak Admin console
|
||||
|
||||
- Login by visiting [`http://localhost:8080`](http://localhost:8080) and clicking on "Administration Console".
|
||||
|
||||
## Create a Keycloak Realm
|
||||
|
||||
- Once you've logged in to the Keycloak console, you can add a realm from the side panel. The default realm should be named "Master".
|
||||
- After you've added a new realm, you can retrieve the `issuer` from the "OpenID Endpoint Configuration" endpoint. The `issuer` will be used as the `Keycloak URL`.
|
||||
- You can find this endpoint from the realm settings under the "General Tab" or visit [`http://localhost:8080/realms/my_realm_name/.well-known/openid-configuration`](http://localhost:8080/realms/my_realm_name/.well-known/openid-configuration)
|
||||
|
||||

|
||||
|
||||
## Create a Keycloak Client
|
||||
|
||||
The "Client ID" of the created client will serve as the `client_id` when you make API calls to authenticate the user.
|
||||
|
||||

|
||||
|
||||
## Client Settings
|
||||
|
||||
After you've created the client successfully, ensure that you set the following settings:
|
||||
|
||||
1. The "Client Protocol" should be set to "openid-connect".
|
||||
2. The "Access Type" should be set to "confidential".
|
||||
3. The "Valid Redirect URIs" should be set to: `https://<project-ref>.supabase.co/auth/v1/callback`.
|
||||
|
||||

|
||||

|
||||
|
||||
## Obtain the Client Secret
|
||||
|
||||
This will serve as the `client_secret` when you make API calls to authenticate the user.
|
||||
Under the "Credentials" tab, the `Secret` value will be used as the `client secret`.
|
||||
|
||||

|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `keycloak` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithKeycloak() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'keycloak',
|
||||
options: {
|
||||
scopes: 'openid',
|
||||
},
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- You can find the keycloak openid endpoint configuration under the realm settings.
|
||||

|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-linkedin.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-linkedin',
|
||||
@@ -7,11 +6,86 @@ export const meta = {
|
||||
description: 'Add LinkedIn OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable LinkedIn Auth for your project, you need to set up a LinkedIn OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up LinkedIn logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a LinkedIn Project and App on the [LinkedIn Developer Dashboard](https://www.linkedin.com/developers/apps).
|
||||
- Add your LinkedIn `client_id` and `client_secret` to your [Supabase Project](https://app.supabase.com).
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js).
|
||||
|
||||
## Access your LinkedIn Developer account
|
||||
|
||||
- Go to [LinkedIn Developer Dashboard](https://www.linkedin.com/developers/apps).
|
||||
- Log in (if necessary.)
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a LinkedIn OAuth app
|
||||
|
||||
- Go to [LinkedIn Developer Dashboard](https://www.linkedin.com/developers/apps).
|
||||
- Click on `Create App` at the top right
|
||||
- Enter your `LinkedIn Page` and `App Logo`
|
||||
- Save your app
|
||||
- Click `Auth` from the top menu
|
||||
- Add your `Redirect URL` to the `Authorized Redirect URLs for your app` section
|
||||
- Copy and save your newly-generated `Client ID`
|
||||
- Copy and save your newly-generated `Client Secret`
|
||||
|
||||
## Enter your LinkedIn credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- In the left sidebar, click the `Authentication` icon (near the top).
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page.
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important).
|
||||
- Under `External OAuth Providers` turn `LinkedIn Enabled` to ON.
|
||||
- Enter your `client_id` and `client_secret` saved in the previous step.
|
||||
- Click `Save`.
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `linkedin` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithLinkedIn() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'linkedin',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [LinkedIn Developer Dashboard](https://api.LinkedIn.com/apps)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-notion.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-notion',
|
||||
@@ -7,11 +6,90 @@ export const meta = {
|
||||
description: 'Add Notion OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable Notion Auth for your project, you need to set up a Notion Application and add the Application OAuth credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Notion logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Notion Application [Notion Developer Portal](https://www.notion.so/my-integrations)
|
||||
- Retrieve your OAuth client ID and OAuth client secret and add them to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Create your notion integration
|
||||
|
||||
- Go to [developers.notion.com](https://developers.notion.com/).
|
||||
- Click "View my integrations" and login.
|
||||
|
||||

|
||||
|
||||
- Once logged in, go to [notion.so/my-integrations](https://notion.so/my-integrations) and create a new integration.
|
||||
- When creating your integration, ensure that you select "Public integration" under "Integration type" and "Read user information including email addresses" under "Capabilities".
|
||||
- You will need to add a redirect uri, see [Add the redirect uri](#add-the-redirect-uri)
|
||||
- Once you've filled in the necessary fields, click "Submit" to finish creating the integration.
|
||||
|
||||

|
||||
|
||||
## Add the redirect URI
|
||||
|
||||
- After selecting "Public integration", you should see an option to add "Redirect URIs".
|
||||
|
||||

|
||||
|
||||
You can retrieve the redirect uri with the following steps:
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
Your redirect uri should look like the following: `https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Add your Notion credentials into your Supabase Project
|
||||
|
||||
- Once you've created your notion integration, you should be able to retrieve the "OAuth client ID" and "OAuth client secret" from the "OAuth Domain and URIs" tab.
|
||||
|
||||

|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Under `External OAuth Providers` turn `Notion Enabled` to ON
|
||||
- Enter the "OAuth client ID" and "OAuth client secret" obtained in the `client id` and `client secret` fields.
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `notion` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithNotion() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'notion',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Notion Account](https://notion.so)
|
||||
- [Notion Developer Portal](https://www.notion.so/my-integrations)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-slack.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-slack',
|
||||
@@ -7,11 +6,99 @@ export const meta = {
|
||||
description: 'Add Slack OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable Slack Auth for your project, you need to set up a Slack OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Slack logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Slack Project and App on the [Slack Developer Dashboard](https://api.slack.com/apps).
|
||||
- Add your Slack `API Key` and `API Secret Key` to your [Supabase Project](https://app.supabase.com).
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js).
|
||||
|
||||
## Access your Slack Developer account
|
||||
|
||||
- Go to [api.slack.com](https://api.slack.com/apps).
|
||||
- Click on `Your Apps` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Slack OAuth app
|
||||
|
||||
- Go to [api.slack.com](https://api.slack.com/apps).
|
||||
- Click on `Create an App`
|
||||
|
||||
Under `Create an app...`:
|
||||
|
||||
- Click `From scratch`
|
||||
- Type the name of your app
|
||||
- Select your `Slack Workspace`
|
||||
- Click `Create App`
|
||||
|
||||
Under `App Credentials`:
|
||||
|
||||
- Copy and save your newly-generated `Client ID`
|
||||
- Copy and save your newly-generated `Client Secret`
|
||||
- Click `Permissions`
|
||||
|
||||
Under `Redirect URLs`:
|
||||
|
||||
- Click `Add New Redirect URL`
|
||||
- Paste your `Callback URL` then click `Add`
|
||||
- Click `Save URLs`
|
||||
|
||||
## Enter your Slack credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- In the left sidebar, click the `Authentication` icon (near the top).
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page.
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important).
|
||||
- Under `External OAuth Providers` turn `Slack Enabled` to ON.
|
||||
- Enter your `Client ID` (`client_id`) and `Client Secret` (`client_secret`) saved in the previous step.
|
||||
- Click `Save`.
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `slack` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithSlack() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'slack',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Slack Developer Dashboard](https://api.slack.com/apps)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-spotify.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-spotify',
|
||||
@@ -7,11 +6,94 @@ export const meta = {
|
||||
description: 'Add Spotify OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable Spotify Auth for your project, you need to set up a Spotify OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Spotify logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Spotify Project and App on the [Spotify Developer Dashboard](https://developer.spotify.com/dashboard/).
|
||||
- Add your Spotify `API Key` and `API Secret Key` to your [Supabase Project](https://app.supabase.com).
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js).
|
||||
|
||||
## Access your Spotify Developer account
|
||||
|
||||
- Log into [Spotify](https://spotify.com)
|
||||
- Access the [Spotify Developer Dashboard](https://developer.spotify.com/dashboard)
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Spotify OAuth app
|
||||
|
||||
- Log into [Spotify](https://spotify.com).
|
||||
- Go to the [Spotify Developer Dashboard](https://developer.spotify.com/dashboard)
|
||||
- Click `Create an App`
|
||||
- Type your `App name`
|
||||
- Type your `App description`
|
||||
- Check the box to agree with the `Developer TOS and Branding Guidelines`
|
||||
- Click `Create`
|
||||
- Save your `Client ID`
|
||||
- Save your `Client Secret`
|
||||
- Click `Edit Settings`
|
||||
|
||||
Under `Redirect URIs`:
|
||||
|
||||
- Paste your Supabase Callback URL in the box
|
||||
- Click `Add`
|
||||
- Click `Save` at the bottom
|
||||
|
||||
## Enter your Spotify credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- In the left sidebar, click the `Authentication` icon (near the top).
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page.
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important).
|
||||
- Under `External OAuth Providers` turn `Spotify Enabled` to ON.
|
||||
- Enter your `Client ID` (`client_id`) and `Client Secret` (`client_secret`) saved in the previous step.
|
||||
- Click `Save`.
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `spotify` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithSpotify() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'spotify',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Spotify Developer Dashboard](https://developer.spotify.com/dashboard/)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,17 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-twilio.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-twilio',
|
||||
title: 'Phone Auth with Twilio',
|
||||
description: 'How to set up and use Mobile OTP with Twilio and Supabase.',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
}
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-twitch.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-twitch',
|
||||
@@ -7,11 +6,106 @@ export const meta = {
|
||||
description: 'Add Twitch OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable Twitch Auth for your project, you need to set up a Twitch Application and add the Application OAuth credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Twitch logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Twitch Application [Twitch Developer Console](https://dev.twitch.tv/console)
|
||||
- Add your Twitch OAuth Consumer keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your Twitch Developer account
|
||||
|
||||
- Go to [dev.twitch.tv](https://dev.twitch.tv).
|
||||
- Click on `Log in with Twitch` at the top right to log in.
|
||||
- If you have not already enabled 2-Factor Authentication for your Twitch Account, you will need to do that at [Twitch Security Settings](https://www.twitch.tv/settings/security) before you can continue.
|
||||
|
||||

|
||||
|
||||
- Once logged in, go to the [Twitch Developer Console](https://dev.twitch.tv/console).
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
In the next step you require a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Twitch Application
|
||||
|
||||

|
||||
|
||||
- Click on `+ Register Your Application` at the top right.
|
||||
|
||||

|
||||
|
||||
- Enter the name of your application.
|
||||
- Type or paste your `OAuth Redirect URL` (the callback URL from the previous step.)
|
||||
- Select a category for your app.
|
||||
- Check the Captcha box and click `Create`.
|
||||
|
||||
## Retrieve your Twitch OAuth Client ID and Client Secret
|
||||
|
||||
- Click `Manage` at the right of your application entry in the list.
|
||||
|
||||

|
||||
|
||||
- Copy your Client ID.
|
||||
- Click `New Secret` to create a new Client Secret.
|
||||
- Copy your Client Secret.
|
||||
|
||||

|
||||
|
||||
## Add your Twitch credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `Twitch Enabled` to ON
|
||||
- Enter your `client_id` and `client_secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `twitch` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithTwitch() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'twitch',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Twitch Account](https://twitch.tv)
|
||||
- [Twitch Developer Console](https://dev.twitch.tv/console)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-twitter.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-twitter',
|
||||
@@ -7,11 +6,95 @@ export const meta = {
|
||||
description: 'Add Twitter OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable Twitter Auth for your project, you need to set up a Twitter OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Twitter logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Twitter Project and App on the [Twitter Developer Dashboard](https://developer.twitter.com/en/portal/dashboard).
|
||||
- Add your Twitter `API Key` and `API Secret Key` to your [Supabase Project](https://app.supabase.com).
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js).
|
||||
|
||||
## Access your Twitter Developer account
|
||||
|
||||
- Go to [developer.twitter.com](https://developer.twitter.com).
|
||||
- Click on `Sign in` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Twitter OAuth app
|
||||
|
||||
- Click `+ Create Project`.
|
||||
- Enter your project name, click `Next`.
|
||||
- Select your use case, click `Next`.
|
||||
- Enter a description for your project, click `Next`.
|
||||
- Enter a name for your app, click `Complete`.
|
||||
- Copy and save your `API Key` (this is your `client_id`).
|
||||
- Copy and save your `API Secret Key` (this is your `client_secret`).
|
||||
- At the bottom, under `Next, setup your App` click the link `enable 3rd party authentication`.
|
||||
- Under `App Settings`, click on the gear icon next to your app name to go to `App Settings`.
|
||||
- At the bottom, next to `Authentication settings`, click `Edit`.
|
||||
- Turn `Enable 3-legged OAuth` ON.
|
||||
- Turn `Request email address from users` ON.
|
||||
- Enter your `Callback URL`.
|
||||
- Enter your `Website URL`.
|
||||
- Enter your `Terms of service URL`.
|
||||
- Enter your `Privacy policy URL`.
|
||||
- Click `Save`.
|
||||
|
||||
## Enter your Twitter credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- In the left sidebar, click the `Authentication` icon (near the top).
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page.
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important).
|
||||
- Under `External OAuth Providers` turn `Twitter Enabled` to ON.
|
||||
- Enter your `API Key` (`client_id`) and `API Secret Key` (`client_secret`) saved in the previous step.
|
||||
- Click `Save`.
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `twitter` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithTwitter() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'twitter',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Twitter Developer Dashboard](https://developer.twitter.com/en/portal/dashboard)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-workos.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-workos',
|
||||
@@ -7,11 +6,88 @@ export const meta = {
|
||||
description: 'Add WorkOS OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable WorkOS Auth for your project, you need to set up WorkOS OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
In this guide, we will cover how to use Supabase OAuth with WorkOS to implement Single-Sign-On(SSO).
|
||||
|
||||
The procedure consists of five broad steps:
|
||||
|
||||
- Create a new organization from your WorkOS Dashboard.
|
||||
- Obtain the `Client ID` from the Configuration tab and configure redirect URI.
|
||||
- Obtain the `WorkOS Secret` from the credentials tab.
|
||||
- Connect a WorkOS Supported Identity Provider
|
||||
- Add your WorkOS credentials into your Supabase project
|
||||
|
||||
## Create a WorkOS Organization
|
||||
|
||||
Log in to the dashboard and hop over to the Organizations tab to create and organization
|
||||

|
||||
|
||||
## Obtain the Client ID and configure Redirect URI
|
||||
|
||||
Head over to the Configuration tab and configure the redirect URI.The redirect URI should look like `https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
Note that this is distinct from the redirect URI referred to in the Supabase dashboard
|
||||
|
||||

|
||||
|
||||
## Obtain the WorkOS Secret
|
||||
|
||||
Head over to the API Keys page and obtain the secret key.
|
||||
|
||||

|
||||
|
||||
## Connect a WorkOS Supported Identity Provider
|
||||
|
||||
Set up the identity provider by visiting the setup link.
|
||||
|
||||

|
||||
|
||||
You can pick between any one of the many identity providers that WorkOS supports.
|
||||
|
||||
## Add your WorkOS credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Under `External OAuth Providers` turn `WorkOS Enabled` to ON
|
||||
- Enter the `Client ID`, `Secret`, and `WorkOS URL` saved in the previous steps. The ``WorkOS URL` setting should be set to https://api.workos.com/
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `workos` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithWorkOS() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'workos',
|
||||
options: {
|
||||
queryParams: {
|
||||
connection: '<your_connection>',
|
||||
organization: '<your_organization',
|
||||
provider: '<your_provider>',
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
Refer to the [WorkOS Documentation](https://workos.com/docs/reference/sso/authorize/) to learn more about the different methods.
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [WorkOS Documentation](https://workos.com/docs/sso/guide)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/auth/auth-zoom.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'auth-zoom',
|
||||
@@ -7,11 +6,95 @@ export const meta = {
|
||||
description: 'Add Zoom OAuth to your Supabase project',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
To enable Zoom Auth for your project, you need to set up a Zoom OAuth application and add the application credentials to your Supabase Dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
Setting up Zoom logins for your application consists of 3 parts:
|
||||
|
||||
- Create and configure a Zoom OAuth App on [Zoom App Marketplace](https://marketplace.zoom.us/)
|
||||
- Add your Zoom OAuth keys to your [Supabase Project](https://app.supabase.com)
|
||||
- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)
|
||||
|
||||
## Access your Zoom Developer account
|
||||
|
||||
- Go to [marketplace.zoom.us](https://marketplace.zoom.us/).
|
||||
- Click on `Sign In` at the top right to log in.
|
||||
|
||||

|
||||
|
||||
## Find your callback URL
|
||||
|
||||
The next step requires a callback URL, which looks like this:
|
||||
|
||||
`https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com).
|
||||
- Click on the `Settings` icon at the bottom of the left sidebar.
|
||||
- Click on `API` in the list.
|
||||
- Under Config / URL you'll find your API URL, you can click `Copy` to copy it to the clipboard.
|
||||
- Now just add `/auth/v1/callback` to the end of that to get your full `OAuth Redirect URI`.
|
||||
|
||||
<video width="99%" muted playsInline controls="true">
|
||||
<source src="/docs/videos/api/api-url-and-key.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
## Create a Zoom Oauth App
|
||||
|
||||
- Go to [marketplace.zoom.us](https://marketplace.zoom.us/).
|
||||
- Click on `Sign In` at the top right to log in.
|
||||
- Click `Build App` (from the dropdown Develop)
|
||||
- In the OAuth card, click `Create`
|
||||
- Type the name of your app
|
||||
- Choose app type
|
||||
- Click `Create`
|
||||
|
||||
Under `App credentials`
|
||||
|
||||
- Copy and save your `Client ID`.
|
||||
- Copy and save your `Client secret`.
|
||||
|
||||
Under `Redirect URL for OAuth`
|
||||
|
||||
- Paste your `Callback URL`
|
||||
- Click `Continue`
|
||||
|
||||
## Enter your Zoom credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Enter the final (hosted) URL of your app under `Site URL` (this is important)
|
||||
- Under `External OAuth Providers` turn `Zoom Enabled` to ON
|
||||
- Enter your `Zoom Client ID` and `Zoom Client Secret` saved in the previous step
|
||||
- Click `Save`
|
||||
|
||||
## Add login code to your client app
|
||||
|
||||
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `zoom` as the `provider`:
|
||||
|
||||
```js
|
||||
async function signInWithZoom() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'zoom',
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
|
||||
|
||||
```js
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Supabase Account - Free Tier OK](https://supabase.com)
|
||||
- [Supabase JS Client](https://github.com/supabase/supabase-js)
|
||||
- [Zoom App Marketplace](https://marketplace.zoom.us/)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,122 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'cli',
|
||||
title: 'Supabase CLI',
|
||||
description:
|
||||
'The Supabase CLI provides tools to develop your project locally and deploy to the Supabase Platform.',
|
||||
sidebar_label: 'Overview',
|
||||
toc_max_heading_level: 2,
|
||||
}
|
||||
|
||||
The Supabase CLI provides tools to develop your project locally and deploy to the Supabase Platform.
|
||||
You can also use the CLI to manage your Supabase projects, handle database migrations and CI/CD workflows, and generate types directly from your database schema.
|
||||
|
||||
## Installation
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
size="small"
|
||||
type="underlined"
|
||||
defaultActiveId="npm"
|
||||
>
|
||||
<TabPanel id="npm" label="npm">
|
||||
|
||||
Install the CLI as dev dependency via [npm](https://www.npmjs.com/package/supabase):
|
||||
|
||||
```sh
|
||||
npm install supabase --save-dev
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
<TabPanel id="macos" label="macOS">
|
||||
|
||||
Install the CLI with [Homebrew](https://brew.sh):
|
||||
|
||||
```sh
|
||||
brew install supabase/tap/supabase
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
<TabPanel id="windows" label="Windows">
|
||||
|
||||
Install the CLI with [Scoop](https://scoop.sh):
|
||||
|
||||
```powershell
|
||||
scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
|
||||
scoop install supabase
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
<TabPanel id="linux" label="Linux">
|
||||
|
||||
The CLI is available through [Homebrew](https://brew.sh) and Linux packages.
|
||||
|
||||
#### Homebrew
|
||||
|
||||
```sh
|
||||
brew install supabase/tap/supabase
|
||||
```
|
||||
|
||||
#### Linux packages
|
||||
|
||||
Linux packages are provided in [Releases](https://github.com/supabase/cli/releases).
|
||||
To install, download the `.apk`/`.deb`/`.rpm` file depending on your package manager
|
||||
and run one of the following:
|
||||
|
||||
- `sudo apk add --allow-untrusted <...>.apk`
|
||||
- `sudo dpkg -i <...>.deb`
|
||||
- `sudo rpm -i <...>.rpm`
|
||||
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
## Updates
|
||||
|
||||
When a new [version](https://github.com/supabase/cli/releases) is released, you can update the CLI using the same methods.
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
size="small"
|
||||
type="underlined"
|
||||
defaultActiveId="npm"
|
||||
>
|
||||
<TabPanel id="npm" label="npm">
|
||||
|
||||
```sh
|
||||
npm update supabase --save-dev
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
<TabPanel id="macos" label="macOS">
|
||||
|
||||
```sh
|
||||
brew upgrade supabase
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
<TabPanel id="windows" label="Windows">
|
||||
|
||||
```powershell
|
||||
scoop update supabase
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
<TabPanel id="linux" label="Linux">
|
||||
|
||||
```sh
|
||||
brew upgrade supabase
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
## See also
|
||||
|
||||
- [Supabase CLI Reference](/docs/reference/cli/usage)
|
||||
- [Local Development](/docs/guides/cli/local-development)
|
||||
- [Managing Environments](/docs/guides/cli/managing-environments)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -1,261 +0,0 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
|
||||
export const meta = {
|
||||
id: 'local-development',
|
||||
title: 'Local Development',
|
||||
description: 'How to use Supabase on your local development machine.',
|
||||
}
|
||||
|
||||
Learn how to use the Supabase CLI to develop your project locally and deploy to the Supabase Platform.
|
||||
|
||||
<div className="video-container">
|
||||
<iframe
|
||||
src="https://www.youtube-nocookie.com/embed/vyHyYpvjaks"
|
||||
frameBorder="1"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowFullScreen
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Make sure you have these installed on your local machine:
|
||||
|
||||
- [Docker](https://docs.docker.com/engine/install/)
|
||||
- [Git](https://github.com/git-guides/install-git)
|
||||
- [Supabase CLI](/docs/guides/cli)
|
||||
|
||||
## Log in to the Supabase CLI
|
||||
|
||||
```bash
|
||||
supabase login
|
||||
```
|
||||
|
||||
## Initialize your project
|
||||
|
||||
Create a new folder for your project and start a new git repository:
|
||||
|
||||
```bash
|
||||
# create your project folder
|
||||
mkdir your-project
|
||||
|
||||
# move into the new folder
|
||||
cd your-project
|
||||
|
||||
# start a new git repository
|
||||
git init
|
||||
```
|
||||
|
||||
## Start Supabase services
|
||||
|
||||
[Initialize](/docs/reference/cli/usage#supabase-init) Supabase to set up the configuration for developing your project locally:
|
||||
|
||||
```bash
|
||||
supabase init
|
||||
```
|
||||
|
||||
Make sure Docker is running. The [start](/docs/reference/cli/usage#supabase-start) command uses Docker to start the Supabase [services](/docs/architecture).
|
||||
This command may take a while to run if this is the first time using the CLI.
|
||||
|
||||
```bash
|
||||
supabase start
|
||||
```
|
||||
|
||||
Once all of the Supabase services are running, you'll see output containing your local Supabase credentials.
|
||||
You can use the [stop](/docs/reference/cli/usage#supabase-stop) command at any time to stop all services.
|
||||
|
||||
## Access services
|
||||
|
||||
You can access services directly with any Postgres client or through the API Gateway ([Kong](https://github.com/Kong/kong)).
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
size="small"
|
||||
type="underlined"
|
||||
defaultActiveId="postgres"
|
||||
>
|
||||
<TabPanel id="postgres" label="Postgres">
|
||||
|
||||
```sh
|
||||
# Default URL:
|
||||
postgresql://postgres:postgres@localhost:54322/postgres
|
||||
```
|
||||
|
||||
The local Postgres instance can be accessed through [`psql`](https://www.postgresql.org/docs/current/app-psql.html)
|
||||
or any other Postgres client, such as [pgadmin](https://www.pgadmin.org/).
|
||||
|
||||
For example:
|
||||
|
||||
```bash
|
||||
psql 'postgresql://postgres:postgres@localhost:54322/postgres'
|
||||
```
|
||||
|
||||
<Admonition type="note">
|
||||
|
||||
To access the database from an edge function in your local Supabase setup, replace `localhost` with `host.docker.internal`.
|
||||
|
||||
</Admonition>
|
||||
|
||||
</TabPanel>
|
||||
<TabPanel id="kong" label="API Gateway">
|
||||
|
||||
```sh
|
||||
# Default URL:
|
||||
http://localhost:54321
|
||||
```
|
||||
|
||||
If you are accessing these services without the client libraries, you may need to pass the client keys as an `Authorization` header.
|
||||
Learn more about [JWT headers](/docs/learn/auth-deep-dive/auth-deep-dive-jwts).
|
||||
|
||||
```sh
|
||||
curl 'http://localhost:54321/rest/v1/' \
|
||||
-H "apikey: <anon key>" \
|
||||
-H "Authorization: Bearer <anon key>"
|
||||
|
||||
http://localhost:54321/rest/v1/ # REST (PostgREST)
|
||||
http://localhost:54321/realtime/v1/ # Realtime
|
||||
http://localhost:54321/storage/v1/ # Storage
|
||||
http://localhost:54321/auth/v1/ # Auth (GoTrue)
|
||||
```
|
||||
|
||||
<Admonition type="note">
|
||||
|
||||
`<anon key>` is provided when you run the command `supabase start`.
|
||||
|
||||
</Admonition>
|
||||
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
## Database migrations
|
||||
|
||||
Database changes are managed through "migrations." Database migrations are a common way of tracking changes to your database over time.
|
||||
|
||||
<div className="video-container">
|
||||
<iframe
|
||||
src="https://www.youtube-nocookie.com/embed/Kx5nHBmIxyQ"
|
||||
frameBorder="1"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowFullScreen
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
### Make database changes
|
||||
|
||||
For this guide, create a table called `employees`. In Supabase Studio, navigate to the **SQL Editor** page and run the following SQL command:
|
||||
|
||||
```sql
|
||||
create table employees (
|
||||
id integer primary key generated always as identity,
|
||||
name text
|
||||
);
|
||||
```
|
||||
|
||||
<Admonition type="note">
|
||||
|
||||
You can execute any SQL using the `DB URL` shown by [`supabase status`](/docs/reference/cli/usage#supabase-status).
|
||||
|
||||
</Admonition>
|
||||
|
||||
Run the [`db diff`](/docs/reference/cli/usage#supabase-db-diff) command to detect changes in the local database:
|
||||
|
||||
```sh
|
||||
supabase db diff create_employees -f create_employees
|
||||
```
|
||||
|
||||
This creates a new migration named `supabase/migrations/<timestamp>_create_employees.sql`, representing any changes made to the local database since [`supabase start`](/docs/reference/cli/usage#supabase-start).
|
||||
|
||||
### Add sample data
|
||||
|
||||
Use the seed script in `supabase/seed.sql` (created with [`supabase init`](/docs/reference/cli/usage#supabase-init)) to add sample data to the table.
|
||||
|
||||
```sql
|
||||
-- in supabase/seed.sql
|
||||
insert into public.employees (name)
|
||||
values
|
||||
('Erlich Backman'),
|
||||
('Richard Hendricks'),
|
||||
('Monica Hall');
|
||||
```
|
||||
|
||||
Rerun the migration and seed scripts:
|
||||
|
||||
```bash
|
||||
supabase db reset
|
||||
```
|
||||
|
||||
You should now see the contents of `employees` in Studio.
|
||||
|
||||
### Reset database changes
|
||||
|
||||
Use the [`reset`](/docs/reference/cli/usage#supabase-db-reset) command to revert any changes to the local database.
|
||||
|
||||
```sql
|
||||
-- run on local database to make a change
|
||||
alter table employees
|
||||
add department text default 'Hooli';
|
||||
```
|
||||
|
||||
Run the following command to reset the local database:
|
||||
|
||||
```sh
|
||||
supabase db reset
|
||||
```
|
||||
|
||||
## Deploy your project
|
||||
|
||||
Go to the [Supabase Dashboard](https://app.supabase.com) and create a project to deploy the changes.
|
||||
|
||||
### Link your project
|
||||
|
||||
<Admonition type="note">
|
||||
|
||||
There are a few commands required to link your project. We are in the process of consolidating these commands into a single command. Bear with us!
|
||||
|
||||
</Admonition>
|
||||
|
||||
Associate your project with your remote project using [`supabase link`](/docs/reference/cli/usage#supabase-link).
|
||||
|
||||
```bash
|
||||
supabase link --project-ref <project-id>
|
||||
# You can get <project-id> from your project’s dashboard URL: https://app.supabase.com/project/<project-id>
|
||||
|
||||
supabase db remote commit
|
||||
# Capture any changes that you have made to your database before setting up the CLI
|
||||
```
|
||||
|
||||
`supabase/migrations` is now populated with a migration in `..._remote_commit.sql`.
|
||||
This migration captures any changes required for your local database to match the schema of your remote Supabase project.
|
||||
|
||||
### Deploy database changes
|
||||
|
||||
Deploy any local database migrations using [`db push`](/docs/reference/cli/usage#supabase-db-push):
|
||||
|
||||
```sh
|
||||
supabase db push
|
||||
```
|
||||
|
||||
### Deploy Edge Functions
|
||||
|
||||
Deploy any Edge Functions using [`functions deploy`](/docs/reference/cli/usage#supabase-functions-deploy):
|
||||
|
||||
```sh
|
||||
supabase functions deploy <function_name>
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
The local development environment is not as feature-complete as the Supabase Platform. Here are some of the differences:
|
||||
|
||||
- The Storage interface is coming soon.
|
||||
- The Functions interface is coming soon.
|
||||
- Logs are not supported through the interface (however you can access them through the Docker containers).
|
||||
- You cannot update your project settings in the Dashboard—this must be done using the CLI.
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -36,11 +36,11 @@ It differs from the `http` extension in that it is asynchronous by default. This
|
||||
<TabPanel id="sql" label="SQL">
|
||||
|
||||
```sql
|
||||
-- Example: enable the "pg_net" extension
|
||||
create schema if not exists net;
|
||||
create extension pg_net with schema net;
|
||||
-- Example: enable the "pg_net" extension.
|
||||
create extension pg_net;
|
||||
-- Note: The extension creates its own schema/namespace named "net" to avoid naming conflicts.
|
||||
|
||||
-- Example: disable the "plv8" extension
|
||||
-- Example: disable the "pg_net" extension
|
||||
drop extension if exists pg_net;
|
||||
drop schema net;
|
||||
```
|
||||
|
||||
@@ -10,8 +10,8 @@ The `uuid-ossp` extension can be used to generate a `UUID`.
|
||||
|
||||
## Overview
|
||||
|
||||
A `UUID` is a "Universally Unique Identifer" and it is, for practical purposes, unique.
|
||||
This makes them particularly well suited as Primary Keys. It is occasionally referred to as a `GUID`, which stands for "Globally Unique Identifer".
|
||||
A `UUID` is a "Universally Unique Identifier" and it is, for practical purposes, unique.
|
||||
This makes them particularly well suited as Primary Keys. It is occasionally referred to as a `GUID`, which stands for "Globally Unique Identifier".
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import Layout from '~/layouts/DefaultGuideLayout'
|
||||
import oldContent from '~/pages/guides/database.mdx'
|
||||
|
||||
export const meta = {
|
||||
id: 'database',
|
||||
@@ -8,11 +7,87 @@ export const meta = {
|
||||
sidebar_label: 'Overview',
|
||||
}
|
||||
|
||||
export const Page = ({ children }) => {
|
||||
if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
|
||||
return oldContent()
|
||||
}
|
||||
return <Layout meta={meta} children={children} />
|
||||
}
|
||||
Every Supabase project comes with a full [Postgres](https://www.postgresql.org/) database, a free and open source
|
||||
database which is considered one of the world's most stable and advanced databases.
|
||||
|
||||
## Postgres or PostgreSQL?
|
||||
|
||||
PostgreSQL the database was derived from the POSTGRES Project, a package written at the University of California at Berkeley in 1986.
|
||||
This package included a query language called "PostQUEL".
|
||||
|
||||
In 1994, Postgres95 was built on top of POSTGRES code, adding an SQL language interpreter as a replacement for PostQUEL.
|
||||
Eventually, Postgres95 was renamed to PostgreSQL to reflect the SQL query capability.
|
||||
|
||||
After this, many people referred to it as Postgres since it's less prone to confusion. Supabase is all about
|
||||
simplicity, so we also refer to it as Postgres.
|
||||
|
||||
## Features
|
||||
|
||||
### Table View
|
||||
|
||||
You don't have to be a database expert to start using Supabase. Our table view makes Postgres as easy to use as a spreadsheet.
|
||||
|
||||

|
||||
|
||||
### Relationships
|
||||
|
||||
Dig into the relationships within your data.
|
||||
|
||||
<video width="99%" loop="" muted="" playsInline="" controls="true">
|
||||
<source src="/docs/videos/relational-drilldown-zoom.mp4" type="video/mp4" />
|
||||
</video>
|
||||
|
||||
### Clone tables
|
||||
|
||||
You can duplicate your tables, just like you would inside a spreadsheet.
|
||||
|
||||
<video width="99%" muted playsInline controls={true}>
|
||||
<source src="/docs/videos/duplicate-tables.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
### The SQL Editor
|
||||
|
||||
Supabase comes with a SQL Editor. You can also save your favorite queries to run later!
|
||||
|
||||
<video width="99%" muted playsInline controls={true}>
|
||||
<source src="/docs/videos/favorites.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
### Additional features
|
||||
|
||||
- Supabase extends Postgres with realtime functionality using our [Realtime Server](https://github.com/supabase/realtime).
|
||||
- Every project is a full Postgres database, with `postgres` level access.
|
||||
- Supabase manages your database backups.
|
||||
- Import data directly from a CSV or excel spreadsheet.
|
||||
|
||||
<Admonition type="note">
|
||||
|
||||
Database backups **do not** include objects stored via the Storage API, as the database only
|
||||
includes metadata about these objects. Restoring an old backup does not restore objects that have
|
||||
been deleted since then.
|
||||
|
||||
</Admonition>
|
||||
|
||||
### Extensions
|
||||
|
||||
To expand the functionality of your Postgres database, you can use extensions.
|
||||
You can enable Postgres extensions with the click of a button within the Supabase dashboard.
|
||||
|
||||
<video width="99%" muted playsInline controls={true}>
|
||||
<source src="/docs/videos/toggle-extensions.mp4" type="video/mp4" muted playsInline />
|
||||
</video>
|
||||
|
||||
[Learn more](/docs/guides/database/extensions) about all the extensions provided on Supabase.
|
||||
|
||||
## Tips
|
||||
|
||||
Read about resetting your database password [here](/docs/guides/database/managing-passwords) and changing the timezone of your server [here](/docs/guides/database/managing-timezones).
|
||||
|
||||
## Next steps
|
||||
|
||||
- Read more about [Postgres](https://www.postgresql.org/about/)
|
||||
- Sign in: [app.supabase.com](https://app.supabase.com)
|
||||
|
||||
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
||||
|
||||
export default Page
|
||||
@@ -265,7 +265,7 @@ For example if you had the following situations:
|
||||
|
||||
- You have a list of `movies`.
|
||||
- A movie can have several `actors`.
|
||||
- An `actor` can perfom in several movies.
|
||||
- An `actor` can perform in several movies.
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
|
||||
@@ -38,7 +38,7 @@ export const meta = {
|
||||
|
||||
### Tutorials
|
||||
|
||||
<div className="grid grid-cols-12 gap-6 not-prose">
|
||||
<div className="grid lg:grid-cols-12 gap-6 not-prose">
|
||||
{webapps.map((item) => {
|
||||
return (
|
||||
<Link href={`/${item.href}`} key={item.title} passHref>
|
||||
@@ -150,15 +150,14 @@ export const resources = [
|
||||
{
|
||||
title: 'Features',
|
||||
hasLightIcon: true,
|
||||
href: '/features',
|
||||
href: '/guides/getting-started/features',
|
||||
description: 'A non-exhaustive list of features that Supabase provides for every project.',
|
||||
},
|
||||
{
|
||||
title: 'Architecture',
|
||||
hasLightIcon: true,
|
||||
href: '/architecture',
|
||||
description:
|
||||
'An overview of Supabase\'s architecture and product principles.',
|
||||
href: '/guides/getting-started/architecture',
|
||||
description: "An overview of Supabase's architecture and product principles.",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
Loaded 100 of 441 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user