You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/AuthProviderWriting.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -157,7 +157,7 @@ If the login fails, `authProvider.login()` should return a rejected Promise with
157
157
158
158
When the user credentials are missing or become invalid, a secure API usually answers to the `dataProvider` with an HTTP error code 401 or 403.
159
159
160
-
Fortunately, each time the `dataProvider` returns an error, react-admin calls the `authProvider.checkError()` method. If it returns a rejected promise, react-admin calls the `authProvider.logout()` method immediately, and asks the user to log in again.
160
+
Fortunately, each time the `dataProvider`or the `authProvider.getPermissions`returns an error, react-admin calls the `authProvider.checkError()` method. If it returns a rejected promise, react-admin calls the `authProvider.logout()` method immediately, and asks the user to log in again.
161
161
162
162
So it's up to you to decide which HTTP status codes should let the user continue (by returning a resolved promise) or log them out (by returning a rejected promise).
163
163
@@ -502,5 +502,5 @@ When the auth backend returns an error, the Auth Provider should return a reject
502
502
|`logout`| Auth backend failed to log the user out |`void`|
503
503
|`getIdentity`| Auth backend failed to return identity |`Object` free format - returned as `error` when `useGetIdentity()` is called |
504
504
|`handleCallback`| Failed to authenticate users after redirection | `void | { redirectTo?: string, logoutOnFailure?: boolean, message?: string }` |
505
-
|`getPermissions`| Auth backend failed to return permissions |`Object` free format - returned as `error` when `usePermissions()` is called |
505
+
|`getPermissions`| Auth backend failed to return permissions |`Object` free format - returned as `error` when `usePermissions()` is called. The error will be passed to `checkError`|
0 commit comments