Skip to content

Commit

Permalink
rm tina cloud auth from self-hosted docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jamespohalloran authored and kldavis4 committed Jul 6, 2023
1 parent 9312b0e commit f1dbda3
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions content/docs/self-hosted/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,33 +187,7 @@ const config = defineConfig({
### Authentication 
#### Using Tina Cloud for Authentication
If you just wish to self host your content and you don't need to customize authentication, you can use Tina Cloud for authorization and authentication. This can be done by adding the following to your endpoint:
##### `pages/api/gql.{ts,js}`
```diff
import { isUserAuthorized } from "@tinacms/auth";

import { databaseRequest } from "../../lib/databaseConnection";
import createDatabase from "../../.tina/database";
const database = createDatabase();

export default async function handler(req, res) {
+ const isAuthorized = await isUserAuthorized({
+ token: req.headers.authorization,
+ clientID: "<YourClientIdFromTinaCloud>",
+ });
+ if (!isAuthorized) {
+ return res.status(401).json({ message: "Unauthorized" });
+ }

const { query, variables } = req.body;
const result = await databaseRequest({ query, variables, database });
return res.json(result);
}
```
Self hosted Tina allows you to integrate your own Auth provder. Our self-hosted-starter uses NextAuth, which provides connections to various auth providers under the hood.
#### Self hosting your Authentication
Expand Down

0 comments on commit f1dbda3

Please sign in to comment.