Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions astro.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,26 @@ export default defineConfig({
autogenerate: { directory: 'typedoc/studiocms-mdx' },
collapsed: true,
},
{
label: '@studiocms/auth0',
autogenerate: { directory: 'typedoc/studiocms-auth0' },
collapsed: true,
},
{
label: '@studiocms/discord',
autogenerate: { directory: 'typedoc/studiocms-discord' },
collapsed: true,
},
{
label: '@studiocms/github',
autogenerate: { directory: 'typedoc/studiocms-github' },
collapsed: true,
},
{
label: '@studiocms/google',
autogenerate: { directory: 'typedoc/studiocms-google' },
collapsed: true,
},
{
label: '@withstudiocms/config-utils',
autogenerate: { directory: 'typedoc/withstudiocms-config-utils' },
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"gen-changelogs": "tsm --require=./scripts/filter-warnings.cjs ./scripts/generate-release-notes.ts"
},
"dependencies": {
"studiocms": "0.1.0-beta.22",
"@studiocms/blog": "0.1.0-beta.22",
"@studiocms/cloudinary-image-service": "0.1.0-beta.22",
"@studiocms/devapps": "0.1.0-beta.22",
"@studiocms/html": "0.1.0-beta.22",
"@studiocms/markdoc": "0.1.0-beta.22",
"@studiocms/md": "0.1.0-beta.22",
"@studiocms/mdx": "0.1.0-beta.22",
"studiocms": "0.1.0-beta.23",
"@studiocms/blog": "0.1.0-beta.23",
"@studiocms/cloudinary-image-service": "0.1.0-beta.23",
"@studiocms/devapps": "0.1.0-beta.23",
"@studiocms/html": "0.1.0-beta.23",
"@studiocms/markdoc": "0.1.0-beta.23",
"@studiocms/md": "0.1.0-beta.23",
"@studiocms/mdx": "0.1.0-beta.23",
"@studiocms/ui": "^0.4.17",
"@studiocms/wysiwyg": "^0.1.0-experimental.5",
"@studiocms/web-vitals": "^4.2.1",
Expand Down
167 changes: 63 additions & 104 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions src/content/docs/en/config-reference/features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,17 @@ export default defineStudioCMSConfig({

Allows enabling or disabling of the Authentication Providers

The following providers can be configured from here: `github`, `discord`, `google`, `auth0`, and `usernameAndPassword`.
The following provider can be configured from here: `usernameAndPassword`.

#### Usage

```ts twoslash {4-13} title="studiocms.config.mjs"
```ts twoslash {4-9} title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
// ---cut---
export default defineStudioCMSConfig({
features: {
authConfig: {
providers: {
github: false,
discord: false,
google: false,
auth0: false,
usernameAndPassword: true,
usernameAndPasswordConfig: {
allowUserRegistration: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ title: "Upgrade: 0.1.0-beta.22"
description: Upgrade StudioCMS to Beta.22
sidebar:
label: 0.1.0-beta.22
badge:
text: NEW
variant: success
order: 999993
---

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
i18nReady: true
title: "Upgrade: 0.1.0-beta.23"
description: Upgrade StudioCMS to Beta.23
sidebar:
label: 0.1.0-beta.23
badge:
text: NEW
variant: success
order: 999992
---

import ReadMore from '~/components/ReadMore.astro'
import QuickUpdate from '~/components/QuickUpdate.astro'
import { Aside } from '@astrojs/starlight/components'

<QuickUpdate />

## Breaking Changes

- Refactor oAuth: oAuth providers have been modularized into separate plugins. This means that you will need to install the respective plugin for each oAuth provider you want to use. The existing oAuth providers have been moved to their respective plugins:
- [`@studiocms/auth0` for Auth0][auth0-plugin]
- [`@studiocms/discord` for Discord][discord-plugin]
- [`@studiocms/github` for GitHub][github-plugin]
- [`@studiocms/google` for Google][google-plugin]

## Bug fixes

- Fix sdk: Correct issue where the `CMSSiteConfigId` is undefined during initialization.
- Fix UserQuickTools Widget: Tweak user quick tools widget and endpoint to prevent an actual 400 error on the user browser

{/* Links */}
[auth0-plugin]: /en/package-catalog/studiocms-plugins/studiocms-auth0/
[discord-plugin]: /en/package-catalog/studiocms-plugins/studiocms-discord/
[github-plugin]: /en/package-catalog/studiocms-plugins/studiocms-github/
[google-plugin]: /en/package-catalog/studiocms-plugins/studiocms-google/
Comment thread
Adammatthiesen marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
i18nReady: true
title: "@studiocms/auth0"
type: integration
catalogEntry: studiocms-auth0
description: "StudioCMS Auth0 Integration"
sidebar:
badge:
text: 'Plugin'
variant: 'tip'
---

import { PackageManagers } from 'starlight-package-managers'
import { Steps, Tabs, TabItem, Aside } from '@astrojs/starlight/components';

This plugin integrates Auth0 as an OAuth provider for StudioCMS, enabling authentication via Auth0. It sets up the necessary configuration, including required environment variables and endpoint paths.

## Usage

Add this plugin in your StudioCMS config. (`studiocms.config.mjs`)

```ts title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
import auth0 from '@studiocms/auth0';

export default defineStudioCMSConfig({
// other options here
plugins: [auth0()]
});
```

## Required ENV Variables

```sh title=".env"
CMS_AUTH0_CLIENT_ID=<your-client-id>
CMS_AUTH0_CLIENT_SECRET=<your-client-secret>
CMS_AUTH0_DOMAIN=<your-domain>
CMS_AUTH0_REDIRECT_URI=<your-redirect-uri>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
i18nReady: true
title: "@studiocms/discord"
type: integration
catalogEntry: studiocms-discord
description: "StudioCMS Discord Integration"
sidebar:
badge:
text: 'Plugin'
variant: 'tip'
---

import { PackageManagers } from 'starlight-package-managers'
import { Steps, Tabs, TabItem, Aside } from '@astrojs/starlight/components';

This plugin integrates Discord as an OAuth authentication provider for StudioCMS. It sets up the necessary configuration, including the required environment variables and OAuth endpoints.

## Usage

Add this plugin in your StudioCMS config. (`studiocms.config.mjs`)

```ts title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
import discord from '@studiocms/discord';

export default defineStudioCMSConfig({
// other options here
plugins: [discord()]
});
```

## Required ENV Variables

```sh title=".env"
CMS_DISCORD_CLIENT_ID=<your-client-id>
CMS_DISCORD_CLIENT_SECRET=<your-client-secret>
CMS_DISCORD_REDIRECT_URI=<your-redirect-uri>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
i18nReady: true
title: "@studiocms/github"
type: integration
catalogEntry: studiocms-github
description: "StudioCMS GitHub Integration"
sidebar:
badge:
text: 'Plugin'
variant: 'tip'
---

import { PackageManagers } from 'starlight-package-managers'
import { Steps, Tabs, TabItem, Aside } from '@astrojs/starlight/components';

This plugin integrates GitHub as an OAuth authentication provider for StudioCMS. It sets up the necessary authentication service, including the provider's name, endpoint paths and required environment variables.

## Usage

Add this plugin in your StudioCMS config. (`studiocms.config.mjs`)

```ts title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
import github from '@studiocms/github';

export default defineStudioCMSConfig({
// other options here
plugins: [github()]
});
```

## Required ENV Variables

```sh title=".env"
CMS_GITHUB_CLIENT_ID=<your-client-id>
CMS_GITHUB_CLIENT_SECRET=<your-client-secret>
CMS_GITHUB_REDIRECT_URI=<your-redirect-uri>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
i18nReady: true
title: "@studiocms/google"
type: integration
catalogEntry: studiocms-google
description: "StudioCMS Google Integration"
sidebar:
badge:
text: 'Plugin'
variant: 'tip'
---

import { PackageManagers } from 'starlight-package-managers'
import { Steps, Tabs, TabItem, Aside } from '@astrojs/starlight/components';

This plugin integrates Google OAuth authentication into StudioCMS. It defines the necessary configuration, including the required environment variables, OAuth provider details, and the endpoint paths for authentication.

## Usage

Add this plugin in your StudioCMS config. (`studiocms.config.mjs`)

```ts title="studiocms.config.mjs"
import { defineStudioCMSConfig } from 'studiocms/config';
import google from '@studiocms/google';

export default defineStudioCMSConfig({
// other options here
plugins: [google()]
});
```

## Required ENV Variables

```sh title=".env"
CMS_GOOGLE_CLIENT_ID=<your-client-id>
CMS_GOOGLE_CLIENT_SECRET=<your-client-secret>
CMS_GOOGLE_REDIRECT_URI=<your-redirect-uri>
```
12 changes: 12 additions & 0 deletions src/content/docs/en/plugins/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ title: The Basics
description: Learn about the StudioCMS plugins and how they work.
sidebar:
order: 1
badge:
text: Updated
variant: success
---

import ReadMore from '~/components/ReadMore.astro'
Expand Down Expand Up @@ -71,6 +74,15 @@ interface StudioCMSPlugin {
servicePath: string | URL;
} | undefined;
}) => void;
setAuthService: (params: {
oAuthProvider?: {
name: string;
formattedName: string;
svg: string;
endpointPath: string;
requiredEnvVariables?: string[] | undefined;
} | undefined;
}) => void;
}) => void | Promise<void>;
}
}
Expand Down
56 changes: 1 addition & 55 deletions src/content/docs/en/start-here/environment-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,58 +44,4 @@ You can generate a secure encryption key using the following command:
```bash
openssl rand --base64 16
```
</Aside>

## Optional Environment Variables

### oAuth Authentication Environment Variables

<ReadMore>
For more information about setting up oAuth authentication, see the [Configure oAuth Authentication][config-oauth] documentation.
</ReadMore>

#### GitHub (Optional)

To authenticate with GitHub, you need to add the following environment variables to your `.env` file:

```bash title=".env"
# credentials for GitHub OAuth
CMS_GITHUB_CLIENT_ID=
CMS_GITHUB_CLIENT_SECRET=
CMS_GITHUB_REDIRECT_URI=
```

<Aside type="note" title="Note">
`CMS_GITHUB_REDIRECT_URI` is optional if you are using multiple redirect URIs with GitHub oAuth.
</Aside>

#### Discord (Optional)

```bash title=".env"
# credentials for Discord OAuth
CMS_DISCORD_CLIENT_ID=
CMS_DISCORD_CLIENT_SECRET=
CMS_DISCORD_REDIRECT_URI=
```

#### Google (Optional)

```bash title=".env"
# credentials for Google OAuth
CMS_GOOGLE_CLIENT_ID=
CMS_GOOGLE_CLIENT_SECRET=
CMS_GOOGLE_REDIRECT_URI=
```

#### Auth0 (Optional)

```bash title=".env"
# credentials for auth0 OAuth
CMS_AUTH0_CLIENT_ID=
CMS_AUTH0_CLIENT_SECRET=
CMS_AUTH0_DOMAIN=
CMS_AUTH0_REDIRECT_URI=
```

{/* Links */}
[config-oauth]: /en/start-here/getting-started/#optional-configure-oauth-authentication
</Aside>
7 changes: 4 additions & 3 deletions src/content/docs/en/start-here/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,11 @@ And set the output as the value for `CMS_ENCRYPTION_KEY`.
For more information about all the available authentication environment variables see, [Environment variables][environment-variables] page.
</ReadMore>

### Optional: Configure oAuth authentication
### Optional: Configure oAuth authentication <Badge text='Revised beta.23' variant='caution' />

StudioCMS supports oAuth authentication with GitHub, Discord, Google, and Auth0. To configure oAuth authentication, you'll need to set the [required environment variables in your `.env` file][oauth-environment-variables], and ensure that the provider is [enabled in your config][auth-config-ref].
StudioCMS supports various oAuth authentication providers, utilizing our plugin system to enable the providers you want to use. To get started, you will need to find a plugin for the provider you want to use, or create your own plugin.

<ReadMore>For more information about the available oAuth authentication plugins see, [Package Catalog][package-catalog]</ReadMore>
Comment thread
Adammatthiesen marked this conversation as resolved.

For setting up oAuth providers, they require a callback URL. The callback URL is the path where the provider will redirect the user after authentication.

Expand Down Expand Up @@ -393,6 +395,5 @@ Learn more about the StudioCMS Config options using the [StudioCMS Reference][co
[config-reference]: /en/config-reference/
[db-url-token]: /en/start-here/environment-variables/#database-url-and-token-for-astrojsdb
[encryption-key]: /en/start-here/environment-variables/#encryption-key-for-studiocmsauth
[oauth-environment-variables]: /en/start-here/environment-variables/#oauth-authentication-environment-variables
[auth-config-ref]: /en/config-reference/features/#authconfig
[self-hosted-libsql]: /en/guides/database/sqld-server/
Loading
Loading