Add Resource Owner Password Grant (ROPG) support#68
Add Resource Owner Password Grant (ROPG) support#68subhankarmaiti wants to merge 1 commit intomainfrom
Conversation
| mocker.patch("httpx.AsyncClient", return_value=mock_httpx_client) | ||
|
|
||
| # Act | ||
| result = await client.get_token_by_password( |
Check notice
Code scanning / CodeQL
Unused local variable Note test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 19 days ago
To fix this, the unused local variable should be removed while preserving the side effect of calling client.get_token_by_password(...). In Python, the idiomatic way is to simply await the coroutine without assigning it, or, if a placeholder is needed, assign it to _. Since the test only cares that the HTTP request was made with specific parameters (checked via mock_httpx_client.post.call_args), it does not need the returned token.
Concretely, in src/auth0_server_python/tests/test_server_client.py, at lines 2058–2066, remove the result = assignment and keep the await expression as a standalone statement. No imports or additional definitions are required, and no other parts of the file need to be changed.
| @@ -2055,7 +2055,7 @@ | ||
| mocker.patch("httpx.AsyncClient", return_value=mock_httpx_client) | ||
|
|
||
| # Act | ||
| result = await client.get_token_by_password( | ||
| await client.get_token_by_password( | ||
| TokenByPasswordOptions( | ||
| username="user@example.com", | ||
| password="secure_password", |
Adds support for the Resource Owner Password Grant flow, allowing highly-trusted applications to authenticate users directly with username and password.
Changes
New API:
get_token_by_password(options: TokenByPasswordOptions)method onServerClientNew Types:
TokenByPasswordOptions- Pydantic model for authentication optionsTokenByPasswordError- Custom error for authentication failuresFeatures
/oauth/tokenendpointaudience,scope, andrealmparametersauth0_forwarded_forfor server-side appsReferences