Skip to content

Conversation

@Sumeet213
Copy link
Contributor

#260

Summary

Add support for Notion's OAuth 2.0 endpoints to enable public integrations
and token management.

Changes

  • Added OAuthEndpoint class with three methods:
    • token() - Exchange authorization codes or refresh tokens
    • introspect() - Validate OAuth tokens
    • revoke() - Revoke OAuth tokens
  • Extended authentication to support Basic auth for OAuth client credentials
  • Added VCR tests for introspect/revoke and mock tests for token exchange

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.53%. Comparing base (7762013) to head (7c4b89e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #301      +/-   ##
==========================================
+ Coverage   99.51%   99.53%   +0.01%     
==========================================
  Files           7        7              
  Lines         411      426      +15     
==========================================
+ Hits          409      424      +15     
  Misses          2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Sumeet213 Sumeet213 marked this pull request as draft November 5, 2025 05:31
@Sumeet213 Sumeet213 force-pushed the feature/add-oauth-endpoints branch 2 times, most recently from 408023f to 54184aa Compare November 5, 2025 05:54
@Sumeet213 Sumeet213 force-pushed the feature/add-oauth-endpoints branch from 54184aa to 7c4b89e Compare November 5, 2025 06:00
@Sumeet213 Sumeet213 marked this pull request as ready for review November 5, 2025 06:12
"external_account",
"refresh_token",
),
auth={"client_id": client_id, "client_secret": client_secret},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @Sumeet213 ! I noticed that in the OAuthEndpoint class of api_endpoints.py like this, the auth parameter is currently constructed as

auth = {"client_id": client_id, "client_secret": client_secret}

I was wondering if it might be more flexible to pass auth directly.

auth=kwargs.get("auth")

Letting users define the dictionary themselves — similar to how Client(auth=NOTION_TOKEN) works.

That said, I also noticed the official TypeScript SDK defines it this way, so it’s indeed a faithful translation.

Just sharing this thought, and please feel free to disregard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants