josx / ra-data-feathers

A feathers rest client for react-admin
MIT License
157 stars 53 forks source link

Invalid JWT: No re-login #173

Open strarsis opened 2 years ago

strarsis commented 2 years ago

When the FeathersJS app users table is changed and the app restarted (e.g. for development), so the originally logged in user doesn't exist anymore, react-admin doesn't return to the login screen. Instead it shows the error message/toast: Please login to continue.

The /authentication response (from FeathersJS): No record found [...].

josx commented 2 years ago

Maybe you can debug ra-data-feathers and check where to force to redirect to login in this case. Can you make on PR? Check here https://github.com/josx/ra-data-feathers/blob/master/src/authClient.js

Anyway it is not an usual use case, because we already support reauthentication for other similar cases.

strarsis commented 2 years ago

@josx: While further debugging this issue I notice that the same message Please login to continue also appears when the FeathersJS app isn't running at all (network error).

josx commented 2 years ago

Maybe you can debug a little more to realize if we can discriminate a network error or a login error, and how to do it.

strarsis commented 2 years ago

@josx: Alright, the following is logged to JavaScript console when auth fails (FeathersJS restart / JWT invalid):

vendor.02334a7e.js:234 Uncaught (in promise) Error: Failed to fetch
    at fVe (vendor.02334a7e.js:234:59200)
    at Ml (vendor.02334a7e.js:234:59498)

The network tab shows a failed request to API, the response tab only shows an error: Failed to load response data: No data found for resource with given identifier

The same with development builds (Error: Failed to fetch).