-
-
Notifications
You must be signed in to change notification settings - Fork 595
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
Getting HTTPError: Response code 401 (Unauthorized) with notion-client #554
Comments
I got exactly same issue. in my case, "dependencies" : { and actual version is 6.16.0. |
I have resolved my issue. In case you encounter a similar situation, please refer to this. The NotionAPI class has a problem with the authToken option, but if you just need to retrieve some data, you don’t need to authorize.
|
I am hesitant to rely on this cookie token thing personally. https://github.com/NotionX/react-notion-x/tree/master/packages/notion-compat import { Client } from '@notionhq/client'
import { NotionCompatAPI } from 'notion-compat'
const notion = new NotionCompatAPI(
new Client({ auth: process.env.NOTION_TOKEN })
)
const recordMap = await notion.getPage(pageId) Note that there are some compatibility limitations if you use |
I recommend using the official Notion API if you need private access with an auth token. This lib is mainly meant to access public notion data. |
@transitive-bullshit If it only query the public page, I think this library doesn't make much sense, beacuse users can load the page by webview directly. |
@liaodalin19903 this library has been around for a long time, before notion's public pages were good and before they ever had an api. you can still do a lot of customization that you can't do with the official public pages. |
Description
I am constatnly getting following error, token and database ID works with
@notionhq/client
but it is not working withnotion-client
What am I doing wrong?⨯ Internal error: HTTPError: Response code 401 (Unauthorized)
at Request.eval (./node_modules/.pnpm/got@11.8.6/node_modules/got/dist/source/as-promise/index.js:118:42)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
digest: "1102196494"
Notion Test Page ID
NOTION_AUTH_TOKEN=secret_thisisasecreat
NOTION_DATABASE_ID=8a42e373328c49a9a495ddd05fce7fa3
The text was updated successfully, but these errors were encountered: