Changelog - 2026-10-10
checkError redirects on a 401 or 403 from the data provider
Bug FixIn one line. DefaultAuthProvider.checkError reads status, else statusCode, so a 401 or 403 thrown by the data provider now logs out or redirects as intended.
What changed
- The status it reads.
checkErrortakesparams.status(react-admin'sHttpError) and, when that is absent,params.statusCode(anApplicationError). Before, it read onlystatus, and an error fromdoRequesthas onlystatusCode, so the401and403branches never ran for a data provider failure. - The branches are unchanged.
401runsauthService.cleanUp()and rejects with{ redirectTo: 'login' }.403rejects with{ redirectTo: '/unauthorized', logoutUser: false }and keeps the session. Anything else resolves. - No error at all.
checkError(undefined)resolves instead of throwing.
Who is affected
- Applications that use
DefaultAuthProvider.checkErroras it is. A401the data provider gives up on (recovery failed or was not allowed) now ends the session and goes to login, and a403now goes to/unauthorized. Make sure the router has an/unauthorizedroute. - Applications that override
checkErrorand read onlystatus. Unchanged, and still blind to data provider failures. Readparams?.status ?? params?.statusCode, or callsuper.checkError(params).
See Auth provider.