I have a dashboard implemented on react-admin. The authentication process was done following this tutorial.
Now I need to implement a forgot password screen, but the problem is that this screen needs to be accessible without being logged in...
I thought of 2 possible ways to implement this:
Can someone explain how to implement either option on the framework?
Thanks in advance,
Based on a comment on the Github issue, I ended up implementing a workaround based on the simple example.
The main thing I did was to add a few custom routes with the noLayout option. These custom routes do not seem to go through authentication for some reason I could not find in the documentation.
So, I redefined my App.js file:
const App = () => (
<Admin
loginPage={Login}
authProvider={authProvider}
dataProvider={dataProvider}
i18nProvider={i18nProvider}
title="Example Admin"
locale="en"
customReducers={{ tree }}
customRoutes={[
<Route exact path="/forgotPassword" component={ForgotPassword} noLayout/>,
<Route exact path="/resetPassword" component={ResetPassword} noLayout/>,
]}
>
{permissions => [
<Resource name="users" {...users} />,
]}
</Admin>
);
Anyways, this is the solution I came up with, not sure if it is the right one. Please let me know if you find something better.
I had a similar issue and adding custom route with noLayout
option still sent me to the login screen.
It turned out not to be the checkAuth
part of the authProvider
causing this.
The cause was getPermissions
part of the authProvider
Under the condition where permissions could not be found I had:
return Promise.reject();
Changing this to: return Promise.resolve([]);
solved it for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With