First of all thanks for the library, it's been great.
I can't seem to figure this error out. If I enable my authProvider, the browsers won't even load as it gets stuck in an infinite loop somehow and I can't figure out where.
What you were expecting:
Providing an authProvider object would call checkAuth, and if that failed, would then call login()
What happened instead:
The page is stuck in a loop which causes the page to never load.
Steps to reproduce:
Related code:
import React from "react";
import {Admin, Resource} from "react-admin";
import jsonServerProvider from 'ra-data-json-server'
import {UserList, UserEdit, UserCreate} from "./components/Users";
import authProvider from './authProviderTest'
import {
AccountList,
AccountShow,
AccountEdit,
AccountCreate,
} from "./components/Accounts";
import UserIcon from "@material-ui/icons/Group";
import BusinessIcon from "@material-ui/icons/Business";
const dataProvider = jsonServerProvider('http://localhost:4000')
const App = () => (
<Admin dataProvider={dataProvider} authProvider={authProvider}>
<Resource
name="users"
list={UserList}
edit={UserEdit}
create={UserCreate}
icon={UserIcon}
/>
<Resource
name="accounts"
list={AccountList}
show={AccountShow}
edit={AccountEdit}
create={AccountCreate}
icon={BusinessIcon}
/>
<Resource
name="permissions"
/>
<Resource
name="states"
/>
</Admin>
);
export default App;
const authProvider = {
login: params => Promise.resolve(),
logout: params => Promise.resolve(),
checkAuth: params => Promise.resolve(),
checkError: error => Promise.resolve(),
getPermissions: params => Promise.resolve(),
getIdentity: () => Promise.resolve(),
};
export default authProvider
Please find full code here.
Other information:
It appears to be creating multiple checkSession threads in the chrome debugger tools.
Environment
"ra-data-json-server": "^3.9.2",
"ra-data-simple-rest": "^3.9.1",
"react": "^16.13.1",
"react-admin": "^3.9.2",
"react-dom": "^16.13.1",
"react-scripts": "3.4.3"
Downgrading to version 3.9.0 worked for me.
Reproduced, thanks for the report. Until the fix is released, you can remove the getIdentity method from your authProvider.
Most helpful comment
Reproduced, thanks for the report. Until the fix is released, you can remove the
getIdentitymethod from yourauthProvider.