notion-sdk-js
notion-sdk-js copied to clipboard
OAuth support?
How do I use the SDK to complete the oauth flow?
Do you mean how you authorize? Head over to https://www.notion.so/my-integrations and create a new integration and paste the token into the client.
@muuvmuuv I am referring to the OAuth flow for public integrations which involves sending a POST request to https://api.notion.com/v1/oauth/token
For future searchers, although lacking OAuth functions from this library is apparently a miss, implementing it, for example with Express, can be fairly straight forward since it's not OAuth2. You redirect your user to the /oauth/authorize endpoint, having them allow access, and Notion redirects user's browser back to your redirect_uri so you can use the code to call /oauth/token for the access token which represents the user. And this wraps up the whole process. Currently Notion API doesn't require you to encrypt or decrypt anything which is way easier than many other OAuth providers.
This is not the most accurate description of the OAuth process but you get the gist. Also you can follow this article if you just want some working code https://naomiperez.netlify.app/notion-oauth-flow/
Hi @mogita Could you please share the that repo? I'm currently working on a project which require notion public integration. I've done with internal integration by specify certain pages but get stuck with public integration(OAuth 2). I'm looking forward to your reply.
/v1/oauth/token has now been incorporated into the SDK as of v2.2.11 🎉