fix revokeSession api call format#328
Conversation
Greptile SummaryThis PR fixes the
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant App as Application
participant UM as UserManagement
participant Client as Client
participant API as WorkOS API
App->>UM: revokeSession(sessionId)
UM->>Client: request(POST, "user_management/sessions/revoke", null, {"session_id": sessionId}, true)
Client->>API: POST /user_management/sessions/revoke<br/>Body: {"session_id": "session_01..."}
API-->>Client: 200 OK (Session JSON)
Client-->>UM: Response array
UM-->>App: Session resource
Last reviewed commit: 5ef74d6 |
| [ | ||
| "session_id" => $sessionId, | ||
| ], |
There was a problem hiding this comment.
Test not updated to match
The corresponding test in tests/WorkOS/UserManagementTest.php:2269-2293 still uses the old path ("user_management/sessions/{$sessionId}/revoke") and passes null as the params argument. The mock expectation won't match the actual call being made now. Please update testRevokeSession to use the new path and pass ["session_id" => $sessionId] as params.
Additionally, the array here uses 2-space indentation, while the rest of the codebase consistently uses 4-space indentation for array contents. Consider aligning to match:
| [ | |
| "session_id" => $sessionId, | |
| ], | |
| [ | |
| "session_id" => $sessionId, | |
| ], |
according to the docs, this should be a post to /user_management/sessions/revoke but it was adding the session id to the url instead which caused a 404 and for the session to not be revoked.
|
updated the unit test as well |
|
@greptile review this |
|
thanks! this is now out as 4.30.1. |
👍 thanks for the quick merge! |
according to the docs, this should be a post to
/user_management/sessions/revoke but it was adding the session id to the url instead which caused a 404 and for the session to not be revoked.
Description
the call as implemented is incorrect, this corrects it to make a properly formatted request to the right endpoint.
Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.