Repository navigation
fix: update LDAP login request to handle accessToken as query parameter - #7934
Conversation
| params: accessToken ? { accessToken } : undefined, | ||
| headers: getSavedTokenHeaders(savedToken), | ||
| }), | ||
| ) |
There was a problem hiding this comment.
Issues / Observations:
-
API contract change (breaking): The endpoint path changed from
/auth/ldap/login/${accessToken}to a fixed/auth/ldap/loginwithaccessTokenmoved into query params. Ensure the backend actually supports the query-param variant; otherwise this is a behavioral regression. -
Potential inconsistency with
postLogin: If the siblingpostLoginstill uses the path-segment pattern, the two login functions now diverge in how they passaccessToken. Verify this divergence is intentional. -
Undefined
params: Passingparams: undefinedis generally harmless in axios, but some wrappers/interceptors may not handle it consistently. Prefer building the config object conditionally or letting the library ignore it (usually fine). -
Semantic/security concern: Moving an access token from path to query string does not materially change exposure (both are logged), but query strings are more commonly logged by proxies/servers. Confirm logging policies.
-
Type safety: No explicit typing on the new
paramsobject; minor, but consider typing for consistency.
Optimization suggestion: Use a spread/conditional to avoid passing undefined:
request.post<ApiResponse<ChatLoginResponse>>('/auth/ldap/login', loginRequest, {
...(accessToken ? { params: { accessToken } } : {}),
headers: getSavedTokenHeaders(savedToken),
})Also add/update a unit test asserting the correct URL + params for both cases (with and without accessToken).
fix: update LDAP login request to handle accessToken as query parameter