Skip to content

Accept the /token login path used by existing clients - #239

Merged
rbardaji merged 1 commit into
mainfrom
feature/accept-token-login-path
Aug 17, 2026
Merged

Accept the /token login path used by existing clients#239
rbardaji merged 1 commit into
mainfrom
feature/accept-token-login-path

Conversation

@rbardaji

Copy link
Copy Markdown
Collaborator

Closes #238

Problem

Login was exposed only at POST /user/login with a JSON body. Existing clients — notably already-installed versions of the ndp-ep Python library — authenticate by posting form-encoded username and password to POST /token. Against an Endpoint those requests get a 404, so those users cannot log in until they upgrade the client.

Fix

Add a POST /token route that accepts form-encoded credentials and returns the same authentication result as /user/login, delegating to the same authenticate_with_credentials. /user/login is unchanged; /token is additive and accepts the form these clients already send (so it must be form-encoded, not JSON — a JSON-only alias would turn the 404 into a 422 and still not help them).

Verified

New TestTokenAliasRoute in tests/test_user_login_route.py: form-encoded credentials return the IDP payload, invalid credentials give 401, and a missing form field gives 422 (not 404). Full suite 1215 passed; black/flake8 clean.

Companion to the client-side fix (ndp-ep 0.8.1, which now posts to /user/login): new clients use /user/login, and this keeps older installed clients working without an upgrade.

Login was exposed only at POST /user/login with a JSON body, but existing
clients — notably already-installed ndp-ep versions — post form-encoded
username and password to POST /token. Against an Endpoint those requests
returned a 404, so those users could not log in until they upgraded.

Add a /token route that accepts form-encoded credentials and returns the
same result as /user/login, by delegating to the same
authenticate_with_credentials. /user/login is unchanged; /token is
additive and takes the form these clients already send.

Closes #238
@rbardaji
rbardaji merged commit 5e9d039 into main Aug 17, 2026
1 check passed
@rbardaji
rbardaji deleted the feature/accept-token-login-path branch August 17, 2026 08:21
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.

Accept the /token login path used by existing clients

1 participant