Add response structure validation in auth token refresh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -34,8 +34,11 @@ export async function refreshTokenAndGetNew() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const response = await axios.post(api, data, config);
|
const response = await axios.post(api, data, config);
|
||||||
const newAccessToken = response.data.access_token;
|
const newAccessToken = response.data?.access_token;
|
||||||
const newRefreshToken = response.data.refresh_token;
|
const newRefreshToken = response.data?.refresh_token;
|
||||||
|
if (!newAccessToken || !newRefreshToken) {
|
||||||
|
throw new Error("Invalid token response structure");
|
||||||
|
}
|
||||||
|
|
||||||
setCookieWithoutExpiration("luciaToken", newAccessToken);
|
setCookieWithoutExpiration("luciaToken", newAccessToken);
|
||||||
// Expire in ~6 months
|
// Expire in ~6 months
|
||||||
|
|||||||
Reference in New Issue
Block a user