Skip to content

Add support for API Tokens for REST API interactions after JWT change - #738

Merged
Tim020 merged 4 commits into
devfrom
jack/api-tokens
Nov 28, 2025
Merged

Add support for API Tokens for REST API interactions after JWT change#738
Tim020 merged 4 commits into
devfrom
jack/api-tokens

Conversation

@pollock83

Copy link
Copy Markdown
Contributor

Since the move to JWT, the tokens regenerate so you cannot simply nab the cookie content anymore to use via an external application interacting with the REST API. Adding functionality to add an API Token to a user's account to authenticate in place of JWTs.

@pollock83
pollock83 requested a review from Tim020 November 27, 2025 22:44
@github-actions github-actions Bot added client Pull requests changing front end code large-diff server Pull requests changing back end code labels Nov 27, 2025
@github-actions

github-actions Bot commented Nov 27, 2025

Copy link
Copy Markdown

Test Results

31 tests   31 ✅  8s ⏱️
 1 suites   0 💤
 1 files     0 ❌

Results for commit e182d5b.

♻️ This comment has been updated with latest results.

@Tim020
Tim020 changed the base branch from main to dev November 28, 2025 19:44
…e to JWT auth

Since the move to JWT, the tokens regenerate so you cannot simply nab the cookie content anymore to use via an external application interacting with the REST API. Adding functionality to add an API Token to a user's account to authenticate in place of JWTs.
@github-actions github-actions Bot added the git label Nov 28, 2025
Added database engine disposal to DigiScriptTestCase.tearDown() to ensure
proper test isolation. Previously, in-memory SQLite database connections
persisted across test methods, causing data leakage that resulted in
2 test failures when tests were run together:

- test_create_admin failed due to username conflicts from previous tests
- test_api_token_get failed because user already had API token from
  previous test execution

The fix ensures each test method gets a fresh database instance by
calling models.db.engine.dispose() in tearDown, forcing the creation
of a new engine for the next test.

Test results improved from 11 passed/2 failed to 31 passed/0 failed
across all test suites.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Tim020
Tim020 merged commit 33d1ecc into dev Nov 28, 2025
14 checks passed
@Tim020
Tim020 deleted the jack/api-tokens branch November 28, 2025 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Pull requests changing front end code git large-diff server Pull requests changing back end code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants