Skip to content

Commit 7b6fe44

Browse files
Merge pull request #272 from ggiande/ggiande/doc-private-page-auth
2 parents dbcf322 + 17d5f74 commit 7b6fe44

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

readme.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,21 @@ export default ({ recordMap }) => (
6666
)
6767
```
6868

69-
You may optionally pass an `authToken` to the API if you want to access private Notion resources.
70-
7169
Note: for heavier blocks, you'll have to opt into using them via `NotionRenderer.components`. These are not included in the default `NotionRenderer` export because they're too heavyweight for a lot of use cases.
7270

71+
## Private Pages
72+
73+
You may optionally pass an `authToken` and `activeUser` to the API if you want to access private Notion pages. Both can be retrieved from your web browser. Once you are viewing your workpace, open your Development Tools > Application > Cookie > and Copy/Paste the `token_v2` and `notion_user_id`. Respectively, activeUser: notion_user_id, authToken: token_v2.
74+
75+
Here's a quick code snippet for the client usage when implementing process env for tokens:
76+
```tsx
77+
const notion = new NotionAPI({
78+
activeUser: process.env.NOTION_ACTIVE_USER,
79+
authToken: process.env.NOTION_TOKEN_V2
80+
})
81+
```
82+
If issue arises where the pageId is not found, restart your local host instance.
83+
7384
## Styles
7485

7586
You'll need to import some CSS styles as well. If you're using Next.js, we recommend you place these imports at the top of `pages/_app.js`:

0 commit comments

Comments
 (0)