Skip to content

Commit 3da32e4

Browse files
committed
docs: updates to draft mode quick start
1 parent 2ca5e46 commit 3da32e4

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

www/content/tutorials/draft-mode/configure-content-types.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ A _site resolver_ tells Drupal how to resolve the draft URL for an entity.
2222
1. Visit `/admin/config/services/next/entity-types`
2323
2. Click **Configure entity type**
2424
3. Select **Article** from the the entity type list
25-
4. Select **Site selector** as the **Site resolver**
26-
5. Select **your site** under **Next.js sites**
27-
6. Click **Save**
25+
4. Click **Save**
26+
5. Edit the newly created entity type.
27+
6. On the Draft Mode tab, select **Site selector** as the **plugin**
28+
7. Select **your site** under **Next.js sites**
29+
8. Click **Save**
2830

2931
<Img
3032
src="/images/next-drupal-configure-entity-type.jpg"

www/content/tutorials/draft-mode/create-oauth-client.mdx

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Before we can create an OAuth consumer, we need to create a new role and a user
1111

1212
As from `next-drupal 1.5`, user roles are used for OAuth scopes. The scopes are automatically handled for the preview based on the currently logged in user.
1313

14+
The OAuth related instructions below are based on the 6.x version of the Simple OAuth module.
15+
1416
</Callout>
1517

1618
---
@@ -78,15 +80,32 @@ openssl rsa -in private.key -pubout > public.key
7880

7981
---
8082

81-
## 5. Create Consumer
83+
## 5. Create Scopes
84+
85+
1. Visit _/admin/config/people/simple_oauth/oauth2_scope/dynamic/add_
86+
2. Fill in the following values:
87+
88+
- **Machine-readable Name**: `nextjs_site`
89+
- **Description**: `Next.js Site`
90+
- **Grant Types**: `Client Credentials`
91+
- **Granularity**: `Role`
92+
- **Role**: `Next.js Site`
93+
94+
3. Click **Save**
95+
96+
---
97+
98+
## 6. Create Consumer
8299

83100
1. Visit _/admin/config/services/consumer/add_
84101
2. Fill in the following values:
85102

86103
- **Label**: `Next.js site`
87-
- **User**: `Select the user we created`
104+
- **Client ID**: `nextjs_site` (or generate a UUID is preferred)
88105
- **Secret**: `Your secret`
89-
- **Scopes**: `Select the role we created`
106+
- **Grant Types**: `Client Credentials`
107+
- **Scopes**: `nextjs_site`
108+
- **User**: `Select the user we created`
90109

91110
3. Click **Save**
92111

@@ -110,15 +129,19 @@ DRUPAL_CLIENT_SECRET=
110129

111130
## 7. Update NextDrupal client.
112131

113-
Update the `NextDrupal` to use the **Bearer** authentication header.
132+
Update the `NextDrupal` client to use the **Bearer** authentication header.
114133

115134
```ts title=lib/drupal.ts
116135
import { NextDrupal } from "next-drupal"
117136

137+
const baseUrl = process.env.NEXT_PUBLIC_DRUPAL_BASE_URL as string
138+
const clientId = process.env.DRUPAL_CLIENT_ID as string
139+
const clientSecret = process.env.DRUPAL_CLIENT_SECRET as string
140+
118141
export const drupal = new NextDrupal(process.env.NEXT_PUBLIC_DRUPAL_BASE_URL, {
119142
auth: {
120-
clientId: process.env.DRUPAL_CLIENT_ID,
121-
clientSecret: process.env.DRUPAL_CLIENT_SECRET,
143+
clientId,
144+
clientSecret,
122145
},
123146
})
124147
```

0 commit comments

Comments
 (0)