jomei / notionapi

A Notion API SDK, written in Golang

Home Page:https://pkg.go.dev/github.com/jomei/notionapi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Authentication Client does not work

evanfuller opened this issue · comments

The CreateToken endpoint uses the same underlying impl request helper function as all other API endpoints in this package.

This implementation is hard-coded to use the Bearer prefix when making requests.

Notion's public docs for this endpoint define that it uses the Basic prefix, where the token is the base64-encoded concatenation of an OAuth app's client ID and secret.

Two possible fixes are:

  1. Band-aid fix by using the Basic prefix for this endpoint only, and expect library users to pass in the base64-encoded token.
  2. Implement a richer Token type that can support both Bearer and Basic cases, the latter of which could include struct fields for ID + Secret, and implement the base64 encoding in this library.

fixed in #145