-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Self hosted docs #1625
Merged
Merged
Self hosted docs #1625
Changes from 176 commits
Commits
Show all changes
211 commits
Select commit
Hold shift + click to select a range
1fe8400
Self-hosted docs
jamespohalloran b4e79d0
bash code tags
jamespohalloran 8be21a4
Fix self-hosted nav bar
jamespohalloran 3cab508
self-hosted config title
jamespohalloran 9312b0e
Rework doc to use Vercel setup
jamespohalloran f1dbda3
rm tina cloud auth from self-hosted docs
jamespohalloran 84fffa6
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] 951a9cd
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] 0a8ba95
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] b9586d8
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] bf19653
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] bd8182a
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] 0c7fcd9
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] 01d5f3a
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] ce1121c
wip
logan-anderson 428eb57
Merge branch 'master' into self-hosted-docs-logan
logan-anderson c8c1927
stub out new docs
logan-anderson 1e59c92
remove old nav
logan-anderson d0072a0
add git provider docs
logan-anderson 3b54b7a
TinaCMS content update by Logan Anderson
tina-cloud-app[bot] 9ccdc7a
add database docs
logan-anderson d96d15e
rename package
logan-anderson a20d536
Merge branch 'master' into self-hosted-docs-logan
logan-anderson 902e996
Merge branch 'master' into self-hosted-docs-logan
logan-anderson 2858c0a
add more context to docs
logan-anderson 10cb6de
update nav
logan-anderson 179fc3b
added screenshot
logan-anderson dc34d36
added auth docs
logan-anderson 38c9f03
add custom auth example
logan-anderson 76ccd57
added graphQL endpoint docs
logan-anderson 6e531b1
Add clerk auth guide
jeffsee55 7c0e7c7
Update clerk docs
jeffsee55 74c544e
Add props for fixing css clashes
jeffsee55 0bf6100
Update content/docs/self-hosted/git-provider/github.md
logan-anderson 052ff65
Update content/docs/self-hosted/core-concepts/overview.md
logan-anderson a7fc136
Apply suggestions from code review
logan-anderson 5ffd2a7
Merge pull request #1635 from tinacms/self-hosted-clerk-auth
logan-anderson 2f8bbf4
add better getting starter docs
logan-anderson dd54968
Merge branch 'master' into self-hosted-docs-logan
logan-anderson 3009741
use example instead of starter
logan-anderson 6f342b8
Upgrade tina
jamespohalloran 838bec1
Merge branch 'master' into self-hosted-docs-logan
jamespohalloran 00754ad
fix broken link in toc-doc
jamespohalloran 26dc8a3
Split out existing site setup
jamespohalloran 0cc10d5
Tweak querying doc
jamespohalloran f519e0e
re-org self-hosted stuff to reference
jamespohalloran cc133b5
rename reference docs
jamespohalloran 474b1e4
Update clerk auth readme
jeffsee55 e144480
Rework archotecture doc
jamespohalloran db4bb86
Rework architecture doc
jamespohalloran d08a1be
fix broken next link
jamespohalloran 8e61441
clean up self-hosted-intro
jamespohalloran 683f7e7
Add disclaimer on search
jamespohalloran 8a6c350
add init-backend docs
jamespohalloran 8d69b9d
fix link
logan-anderson 141fea2
Update content/docs/reference/self-hosted/database-adapter/mongodb.md
jamespohalloran 559e4bb
TinaCMS content update by James O'Halloran
tina-cloud-app[bot] 92d4464
Merge pull request #1642 from tinacms/self-hosted-docs-logan-clerk-up…
logan-anderson 21cd198
added links to hubspot calendar for demo
scottgallant d826f56
updated button text and style
scottgallant 3c615f7
TinaCMS content update by Kelly Davis (#1641)
tina-cloud-app[bot] e3c51b8
TinaCMS content update by James O'Halloran
tina-cloud-app[bot] eb5c1e5
Support page (#1645)
jamespohalloran a9339cd
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 9a5cf92
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 6e14466
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] bc37eb5
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 721e947
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 57e4597
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] e0673b9
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] a450638
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 5ee45f4
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] cef2867
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] b58900c
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] e27e6f4
renamed file
scottgallant b98815c
added press link to footer
scottgallant dfc7afe
Update altair link
jamespohalloran a45e2ca
docs: Improve docs for non-next external-media (#1649)
jamespohalloran 17befe9
Remove links to playground (#1648)
jamespohalloran 4a12e20
Internationalization (#1650)
jamespohalloran 217a13e
updated lock
scottgallant 23fd1b5
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] e65cd4a
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] a944cf7
added new quote block
scottgallant 2d3acd4
removed unused imports
scottgallant 97a37c9
wip add quote block
scottgallant ef546e2
tweaked styles and contenet
scottgallant 461d5e0
updated homepage and added quote block
scottgallant 6f53f10
updates to homepage feature block and content
scottgallant 5a58909
updated gif
scottgallant 7571721
updated gif
scottgallant 8c737b8
rm iframes from datepicker
jamespohalloran ad5048e
fix typo in guide meta
jamespohalloran 34e80b1
fix typo
jamespohalloran d183dab
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] cad82f0
fix link
logan-anderson 769b880
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 229f487
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 7f2298d
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] c6295a4
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] ff09137
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 86da13a
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 88d5171
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 278e635
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 4b2e99c
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] d0bec95
added logos to enterprise page
scottgallant bb9f593
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 0e60b5f
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 02740c3
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 57e0aa1
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] e9c1af9
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 0c4cd0d
update auth docs to use config (#1661)
logan-anderson 51e53df
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] ec16e73
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 6339659
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 1c15a61
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] ec34356
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 78147c2
tweaked content on enterprise page
scottgallant bb15dd7
Remove embedded playgrounds from docs
jeffsee55 7227de3
Remove redundant content from Many Hands showcase
infotexture 20a2ef2
Update product-tour.md (#1666)
Jemeni11 1ed8789
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] ea96687
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] 8fbb2ef
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] 77ab1b3
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] 36b69b1
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] 5493e70
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] b285449
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] f4f3747
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] 5f8b361
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] d2719f7
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] 3caafb8
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] fb82334
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] 3216214
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] 799f6aa
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] d1a8db4
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] d424221
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] b2c66f9
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] 30b7289
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] a68847e
TinaCMS content update by Scott Gallant
tina-cloud-app[bot] 58be539
Capitalize the H in GitHub and align social icons (#1670)
cassidoo 0ee976a
TinaCMS content update by Logan Anderson
tina-cloud-app[bot] cdbbb8d
TinaCMS content update by Logan Anderson
tina-cloud-app[bot] 44bd365
TinaCMS content update by Logan Anderson
tina-cloud-app[bot] effa9bb
TinaCMS content update by Logan Anderson
tina-cloud-app[bot] cd09b92
TinaCMS content update by Logan Anderson
tina-cloud-app[bot] 71464f7
Update content/docs/errors/ambiguous-template.md
logan-anderson 898660e
update lock file
logan-anderson afb195d
update lock file
logan-anderson 95a5c43
Merge branch 'master' into self-hosted-docs-logan
logan-anderson 74b6692
remove link to older github discussion
logan-anderson febf4f2
update lock file
logan-anderson 799102f
update docs to use new auth pattern
logan-anderson 3f1f47e
update bring auth docs
logan-anderson b4ba8a8
update tina-cloud auth docs
logan-anderson 15e0225
update contentApiUrlOverride
logan-anderson 57fde38
update self hosting overview
logan-anderson a6cc678
update clerk docs
logan-anderson fbc97e3
Apply suggestions from code review
logan-anderson f347e1f
fix toc to be consistent
kldavis4 1853a8f
update authentication provider overview to show next-auth
logan-anderson 8263466
remove unused doc
logan-anderson 6cf5377
update session provider docs
logan-anderson cec18e3
Update content/docs/self-hosted/overview.md
logan-anderson 6c26e3d
ENG-1177 self-hosted user management
kldavis4 ef47785
update overview doc
logan-anderson 1b1cc8f
remove prev link
kldavis4 c56d8b9
TinaCMS content update
tina-cloud-app[bot] 37a2e33
TinaCMS content update
tina-cloud-app[bot] 5168145
TinaCMS content update
tina-cloud-app[bot] 64f22f9
TinaCMS content update
tina-cloud-app[bot] 192d37c
add backend docs
logan-anderson 62fbea7
update based on feedback from scott
logan-anderson 01d1381
Merge branch 'self-hosted-docs-logan' into kldavis4/user_management
logan-anderson acf0a12
Merge pull request #1681 from tinacms/kldavis4/user_management
logan-anderson 0132433
update self hosted overview
logan-anderson 6e8fa9c
add namespace to createDatabase ref doc and other misc fixes
kldavis4 2757a42
misc: fixes to backend hosting docs
kldavis4 61dfdd4
Merge pull request #1684 from tinacms/kldavis4/selfhosted_ref_updates
logan-anderson 28064ba
Merge pull request #1685 from tinacms/kldavis4/fixes
logan-anderson bd71a77
add links to demo repo
logan-anderson 1846185
fix build
logan-anderson 3101fe9
Merge branch 'master' into self-hosted-docs-logan
logan-anderson ece48d5
update lock file
logan-anderson 825a3ad
update user management section
logan-anderson 5743ddd
add video to docs
logan-anderson 3a7dd97
add link and faq
logan-anderson f821728
update faq
logan-anderson e2f3415
update vercel quick start
logan-anderson 5ea8608
use self-host branch of the starter
logan-anderson 1302c42
update content
logan-anderson 58fb56a
lower case b
logan-anderson 5b16136
update based on feedback from Scott
logan-anderson 02664d7
Update content/docs/reference/self-hosted/authentication-provider/aut…
logan-anderson fac3f93
update overview
logan-anderson 71c5a9d
update authprovider terminology - emphasize default happy path for au…
kldavis4 699a507
update link
kldavis4 56bd0ca
pr feedback
kldavis4 d6cfb72
Merge pull request #1693 from tinacms/kldavis4/auth_provider_ref_refa…
logan-anderson d1cc3e2
Merge branch 'self-hosted-docs-logan' into update-overview
logan-anderson a8485d1
fix vercel and netlify functions docs
logan-anderson f8264ae
Update content/docs/self-hosted/overview.md
logan-anderson 68e809e
Merge pull request #1692 from tinacms/update-overview
logan-anderson 42736c3
use new upstash-redis-level version
logan-anderson 93489e0
add reference doc for switch to discord auth provider
kldavis4 5a75a28
Merge pull request #1695 from tinacms/kldavis4/authjs_provider
logan-anderson 95e2a51
add video
logan-anderson 4409da8
update branch
logan-anderson 0dcc68f
update branch
logan-anderson e0e2837
Merge branch 'master' into self-hosted-docs-logan
logan-anderson eaf17a6
add links to code
logan-anderson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 125 additions & 0 deletions
125
content/docs/reference/self-hosted/authentication-provider/bring-your-own.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,125 @@ | ||||||
--- | ||||||
title: Custom Auth Provider | ||||||
id: '/docs/reference/self-hosted/authentication-provider/bring-your-own' | ||||||
prev: '/docs/reference/self-hosted/authentication-provider/tina-cloud' | ||||||
next: null | ||||||
--- | ||||||
|
||||||
To self-host with a custom auth provider, you will need to do do two things. | ||||||
|
||||||
## 1. Create a custom Authentication Provider Class | ||||||
|
||||||
You can do so by extending the `AbstractAuthProvider` class and implementing the following functions: | ||||||
|
||||||
### Required Functions | ||||||
|
||||||
`authenticate`: This function is called when the user goes into `/admin` and they are not logged in (determined by `getUser`). This function should redirect the user to the login page or do whatever is necessary to authenticate the user. | ||||||
|
||||||
`getUser`: This function is called when the user goes into `/admin` and is used to determine if the user is logged in. If it returns a truthy value, the user is logged in. If it returns a falsy value the user is not logged in. | ||||||
|
||||||
`getToken`: This function is called when a request is made to the GraphQL endpoint. It should return an object with an `id_token` property. This will be passed as an `Authorization` header in the format `Bearer <id_token>` | ||||||
|
||||||
`logOut`: This function is called when the user clicks the logout button. | ||||||
|
||||||
### Optional Functions | ||||||
|
||||||
`getSessionProvider`: Return a React context provider that wraps the TinaCMS UI. | ||||||
|
||||||
```ts | ||||||
import { AbstractAuthProvider } from 'tinacms' | ||||||
|
||||||
export class CustomAuthProvider extends AbstractAuthProvider { | ||||||
constructor() { | ||||||
super() | ||||||
// Do any setup here | ||||||
} | ||||||
async authenticate(props?: {}): Promise<any> { | ||||||
// Do any authentication here | ||||||
} | ||||||
getToken() { | ||||||
// Return the token here. The token will be passed as an Authorization header in the format `Bearer <token>` | ||||||
} | ||||||
async getUser() { | ||||||
// Returns a truthy value, the user is logged in and if it returns a falsy value the user is not logged in. | ||||||
} | ||||||
logout() { | ||||||
// Do any logout logic here | ||||||
} | ||||||
async authorize(context?: any): Promise<any> { | ||||||
// Do any authorization logic here | ||||||
} | ||||||
getSessionProvider() { | ||||||
kldavis4 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
// GetSessionProvider can be deleted if not needed | ||||||
// OPTIONALLY Return a React context provider to that will wrap the admin | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
Now you can add your custom auth provider to your config file: | ||||||
|
||||||
```javascript | ||||||
export default defineConfig({ | ||||||
authProvider: isLocal ? new LocalAuthProvider() : new CustomAuthProvider(), | ||||||
//... | ||||||
}) | ||||||
``` | ||||||
|
||||||
## 2. Add Authentication to the Tina Backend | ||||||
|
||||||
`TinaNodeBackend` takes an `authentication` Prop. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
consider changed to backendAuthProvider or similar? |
||||||
|
||||||
```ts | ||||||
export interface BackendAuthentication { | ||||||
initialize?: () => Promise<void> | ||||||
isAuthorized: ( | ||||||
req: IncomingMessage, | ||||||
res: ServerResponse | ||||||
) => Promise< | ||||||
| { | ||||||
isAuthorized: true | ||||||
} | ||||||
| { | ||||||
isAuthorized: false | ||||||
errorMessage: string | ||||||
errorCode: number | ||||||
} | ||||||
> | ||||||
// You can use this if you need to attach any extra routes to the backend. Ex, a callback route for OAuth | ||||||
extraRoutes?: { | ||||||
[key: string]: { | ||||||
// If secure is true the `isAuthorized` function will be called before the handler is called | ||||||
secure?: boolean | ||||||
handler: (req: IncomingMessage, res: ServerResponse) => Promise<void> | ||||||
} | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
This Interface must be passed to the `authentication` prop of `TinaNodeBackend`. You can get the token from the request by calling `req.headers.authorization`.This token should be validated in the `isAuthorized` function. | ||||||
|
||||||
```ts | ||||||
const CustomBackendAuth = () => { | ||||||
return { | ||||||
isAuthorized: async (req, res) => { | ||||||
const token = req.headers.authorization | ||||||
// Validate the token here | ||||||
return { | ||||||
isAuthorized: true, | ||||||
} | ||||||
}, | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
For an example of how to do this, see the [AuthJS Backend]() | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO |
||||||
|
||||||
Once you have created an object that implements the `BackendAuthentication` interface, you can pass it to the `authentication` prop of `TinaNodeBackend` | ||||||
|
||||||
`/pages/api/tina/[...routes].{ts,js}` | ||||||
|
||||||
```ts | ||||||
const handler = TinaNodeBackend({ | ||||||
authentication: isLocal ? LocalBackendAuthentication() : CustomBackendAuth(), | ||||||
databaseClient, | ||||||
}) | ||||||
``` |
97 changes: 97 additions & 0 deletions
97
content/docs/reference/self-hosted/authentication-provider/clerk-auth.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
--- | ||
id: '/docs/reference/self-hosted/authentication-provider/next-auth' | ||
title: NextAuth Authentication Provider | ||
prev: '/docs/reference/self-hosted/authentication-provider/overview' | ||
next: '/docs/reference/self-hosted/authentication-provider/tina-cloud' | ||
--- | ||
|
||
[Clerk](https://clerk.com) is a user management service which you can use with a self-hosted Tina setup. | ||
|
||
## Getting Started | ||
|
||
To get started you will need to install the following dependencies: | ||
|
||
```bash | ||
yarn add @clerk/clerk-js @clerk/backend tinacms-clerk | ||
``` | ||
|
||
## Setup | ||
|
||
Visit [clerk.com](https://clerk.com/) to create an account and an "application". Once you've done that, navigate to the API Keys tab to find your credentials and store them in the .env file in your project. | ||
|
||
![Clerk API Keys screenshot](/img/clerk-api-keys-screenshot.png) | ||
|
||
Be sure to update `TINA_PUBLIC_ALLOWED_EMAIL` with the email address you'll use to sign in to Clerk. | ||
|
||
```bash | ||
CLERK_SECRET=sk_test_my-clerk-secret | ||
TINA_PUBLIC_CLERK_PUBLIC_KEY=pk_test_my-clerk-public-key | ||
TINA_PUBLIC_ALLOWED_EMAIL="[email protected]" | ||
``` | ||
|
||
## Update the dev command | ||
|
||
When self-hosting, you may want to disable auth for local development. | ||
|
||
```json | ||
"scripts": { | ||
"dev": "TINA_PUBLIC_IS_LOCAL=true tinacms dev -c \"next dev\"", | ||
"dev:prod": "tinacms dev -c \"next dev\"", | ||
} | ||
``` | ||
|
||
## Update your Tina Config | ||
|
||
Add the following to your `tina/config.{ts.js}` file. Be sure to replace "[email protected]" with the email you're signing in with: | ||
|
||
```ts | ||
import { ClerkAuthProvider } from 'tinacms-clerk/dist/frontend' | ||
|
||
//... | ||
|
||
const isLocal = process.env.TINA_PUBLIC_IS_LOCAL === 'true' | ||
|
||
export default defineConfig({ | ||
//... | ||
contentApiUrlOverride: '/api/tina/gql', | ||
authProvider: isLocal ? new LocalAuthProvider() : new ClerkAuthProvider(), | ||
//... | ||
}) | ||
``` | ||
|
||
Note that we're checking if the signed-in user's email exists in a hardcoded array. There are a few ways to do this in a more maintainable way: | ||
|
||
- Create an organization in Clerk, and check to see if the signed-in user is part of the org for this project | ||
- Create an ["allow-list"](https://clerk.com/docs/authentication/allowlist). Note that this is a paid feature. | ||
|
||
## Update the Tina Backend | ||
|
||
Add the following to your `pages/api/tina/[...routes].{ts,js}` file | ||
|
||
```ts | ||
import { TinaNodeBackend, LocalBackendAuthentication } from '@tinacms/datalayer' | ||
import { ClerkBackendAuthentication } from 'tinacms-clerk' | ||
|
||
import databaseClient from '../../../tina/__generated__/databaseClient' | ||
|
||
const isLocal = process.env.TINA_PUBLIC_IS_LOCAL === 'true' | ||
|
||
const handler = TinaNodeBackend({ | ||
authentication: isLocal | ||
? LocalBackendAuthentication() | ||
: ClerkBackendAuthentication({ | ||
/** | ||
* For premium Clerk users, you can use restrictions | ||
* https://clerk.com/docs/authentication/allowlist | ||
*/ | ||
allowList: [process.env.TINA_PUBLIC_ALLOWED_EMAIL], | ||
secretKey: process.env.CLERK_SECRET, | ||
}), | ||
databaseClient, | ||
}) | ||
|
||
export default (req, res) => { | ||
// Modify the request here if you need to | ||
return handler(req, res) | ||
} | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
document
authorize()
function