Skip to content

feat: setup-dot-and-metadata-endpoint#7057

Open
Zaimwa9 wants to merge 16 commits intomainfrom
feat/setup-dot-and-as-metadata
Open

feat: setup-dot-and-metadata-endpoint#7057
Zaimwa9 wants to merge 16 commits intomainfrom
feat/setup-dot-and-as-metadata

Conversation

@Zaimwa9
Copy link
Copy Markdown
Contributor

@Zaimwa9 Zaimwa9 commented Mar 27, 2026

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to #7032

  • Add django-oauth-toolkit as a dependency
  • Add oauth2_provider to INSTALLED_APPS and OAuth2Authentication to DRF authentication classes
  • Configure OAUTH2_PROVIDER settings: 15min access tokens, 30-day rotating refresh tokens, PKCE S256 mandatory, mcp scope
  • Add FLAGSMITH_API_URL and FLAGSMITH_FRONTEND_URL environment variables (for self-hosted)
  • Expose DOT endpoints under /o/ (authorize, token, revoke, introspect)
  • Add GET /.well-known/oauth-authorization-server metadata endpoint (RFC 8414)
  • Add daily cleartokens recurring task to clear expired OAuth2 tokens

🟢 Includes a Node.js test server (node auth2_test_server.mjs) to test e2e => http://localhost:3000

How did you test this code?

  • New tests
  • curl http://localhost:8000/.well-known/oauth-authorization-server
  • Manual e2e using node oauth2_test_server.mjs :
    a. Create a public OAuth application in Django admin at /admin/oauth2_provider/application/add_/
    (Authorization: code grant, redirect URI: http://localhost:3000/oauth/callback)
    b. Update CLIENT_ID in oauth2_test_server.mjs with the generated client ID
    c. Run the server and open http://localhost:3000
    d. Approve the authorisation, token is exchanged automatically
    You should receive a payload like:
{
  "access_token": "gC1lOUXpMv22K4L5mQipQE6SKzwBqA",
  "expires_in": 900,
  "token_type": "Bearer",
  "scope": "mcp",
  "refresh_token": "iRpml11oIDiuQXbNmkXE2jKB03bkal"
}

@Zaimwa9 Zaimwa9 requested a review from a team as a code owner March 27, 2026 16:18
@Zaimwa9 Zaimwa9 requested review from khvn26 and removed request for a team March 27, 2026 16:18
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@Zaimwa9 Zaimwa9 requested review from gagantrivedi and removed request for khvn26 March 27, 2026 16:18
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Mar 30, 2026 10:47am
flagsmith-frontend-preview Ignored Ignored Preview Mar 30, 2026 10:47am
flagsmith-frontend-staging Ignored Ignored Preview Mar 30, 2026 10:47am

Request Review

@github-actions github-actions bot added api Issue related to the REST API feature New feature or request labels Mar 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-7057 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-7057 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-7057 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-7057 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7057 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7057 Finished ✅ Results

Comment on lines +56 to +57
# Authorize template view for testing: this will be moved to the frontend in following issues
path("o/", include("oauth2_provider.urls", namespace="oauth2_provider")),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reminder

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Mar 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  41.2 seconds
commit  eeb1584
info  🔄 Run: #15519 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  28 seconds
commit  eeb1584
info  🔄 Run: #15519 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  52.1 seconds
commit  e190637
info  🔄 Run: #15518 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  23.6 seconds
commit  e330174
info  🔄 Run: #15520 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  45 seconds
commit  e190637
info  🔄 Run: #15518 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  1 minute, 1 second
commit  e190637
info  🔄 Run: #15518 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  52.2 seconds
commit  e330174
info  🔄 Run: #15520 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  58.9 seconds
commit  e330174
info  🔄 Run: #15520 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  47.1 seconds
commit  ccd5ffd
info  🔄 Run: #15521 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  52 seconds
commit  ccd5ffd
info  🔄 Run: #15521 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  55.8 seconds
commit  ccd5ffd
info  🔄 Run: #15521 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  1 minute, 2 seconds
commit  ccd5ffd
info  🔄 Run: #15521 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  42.4 seconds
commit  262ebda
info  🔄 Run: #15522 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  24.6 seconds
commit  1f0d84e
info  🔄 Run: #15523 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  46.7 seconds
commit  262ebda
info  🔄 Run: #15522 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  53.1 seconds
commit  1f0d84e
info  🔄 Run: #15523 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  45 seconds
commit  262ebda
info  🔄 Run: #15522 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  28 seconds
commit  74d4fc1
info  🔄 Run: #15543 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  42.5 seconds
commit  74d4fc1
info  🔄 Run: #15543 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

failed  2 failed

Details

stats  2 tests across 2 suites
duration  34.1 seconds
commit  74d4fc1
info  📦 Artifacts: View test results and HTML report
🔄 Run: #15543 (attempt 1)

Failed tests

firefox › tests/change-request-test.pw.ts › Change Request Tests › Change requests can be created, approved, and published with 4-eyes approval @enterprise
firefox › tests/roles-test.pw.ts › Roles Tests › Roles can be created with project and environment permissions @enterprise

### Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  26.9 seconds
commit  36477da
info  🔄 Run: #15548 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  29.5 seconds
commit  36477da
info  🔄 Run: #15548 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  52.2 seconds
commit  36477da
info  🔄 Run: #15548 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  58.9 seconds
commit  36477da
info  🔄 Run: #15548 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  43 seconds
commit  ec0b067
info  🔄 Run: #15549 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  51.5 seconds
commit  ec0b067
info  🔄 Run: #15549 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  44 seconds
commit  ec0b067
info  🔄 Run: #15549 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 9 seconds
commit  ec0b067
info  🔄 Run: #15549 (attempt 1)

@github-actions
Copy link
Copy Markdown
Contributor

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  42 seconds
commit  e190637
info  🔄 Run: #15518 (attempt 1)

@Zaimwa9 Zaimwa9 requested a review from a team as a code owner March 27, 2026 16:36
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Mar 27, 2026
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Mar 27, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.27%. Comparing base (61ca107) to head (ec0b067).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7057      +/-   ##
==========================================
- Coverage   98.33%   98.27%   -0.07%     
==========================================
  Files        1337     1344       +7     
  Lines       50012    50126     +114     
==========================================
+ Hits        49180    49259      +79     
- Misses        832      867      +35     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Mar 30, 2026
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant