Skip to content

IA-941 : fix(auth): resolve login token extraction and 401 interceptor loop

khadija.elbachouri a demandé de fusionner feature/IA-941 vers develop

Problem

Login was completely broken for parent mobile app users. Three compounding bugs caused the failure:

  1. The 401 response interceptor triggered signOut() on failed login attempts, swallowing the real error and returning undefined instead of a meaningful message.
  2. Token extraction assumed response.data.token exclusively, breaking compatibility with APIs returning access_token, accessToken, or nested data.token.
  3. Debug logs were placed inside forgotPassword instead of signInWithPassword, making the issue impossible to diagnose.

Changes

  • Interceptor fix: Exclude the login endpoint from the 401 handler so failed credentials return a proper error instead of silently calling signOut()
  • Token extraction: Support multiple response formats (token, access_token, accessToken, data.token, data.access_token)
  • Error logging: Replaced partial error.response?.data?.message log with full error object (message, code, status, data) for future debugging
  • Debug logs: Moved URL and RESPONSE DATA logs to the correct function

Rapports de requête de fusion