-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
permission disables the option to add routes to customRoutes in app.js #6015
Comments
Hi, and thanks for your input. I can't reproduce the problem on the simple example: I can access the '/custom' route even when logged out. We'll need more details to investigate this issue. That's why we've written an issue template listing the elements we need to qualify a bug.
insert short code snippets here
Please follow it, including a link to a modified Codesandbox that shows the problem. |
What you were expecting: What happened instead: Steps to reproduce:
But I don't want to return any resource without the user having permissions 5036 y # 4821 son el mismo problema.
|
@DanielSanchez94 If you want us to pay attention to your bug report, please include a link to a working codesandbox showing your problem, as explained in the issue template. The code you pasted can't be run. Also, if you need rapid feedback, I suggest you subscribe to the Enterprise Edition of the framework. If you don't, please refrain from updating your issue like you just did - it creates noise, and we have enough of that. |
https://codesandbox.io/s/zen-lamarr-i3b9d?file=/src/App.js This is an example. I understand that the login doesn't work, but the link to "/prueba" should work. |
Your codesandbox is incorrect. You're returning resources in an array of arrays. Also, when you don't want to return any resource, you must return an empty array, not null. And when returning an empty array, react-admin displays the loading screen (which you can customize). https://codesandbox.io/s/competent-antonelli-fmi1w?file=/src/App.js |
@fzaninotto is normal access a custom route without login? |
a custom route with no layout is accessible without authentication. If you want to check authentication in such routes, use the useAuthenticated hook (https://marmelab.com/react-admin/Authentication.html#useauthenticated-hook). |
But without the property noLayout, like in the demo example: react-admin/examples/demo/src/routes.tsx Lines 7 to 8 in 2ee2a98
you can access those custom pages ( https://marmelab.com/react-admin-demo/#/configuration. Btw, useAuthenticated hook can resolve. Maybe is some breaking change that I don't have read and sorry for that! |
i resolve this issue of this way:
Which leads me to think that there is something missing in the documentation, which happens when the Admin does not enter under any conditions, then nothing returns. There, it breaks and stops working, even the routes defined in the customRoutes. In the documentation example, just return Resources with no conditions, then there is no problem. But, if you want to add conditions like me then this won't work. unless it |
I reopen this issue, since I run into the same problem again. When I access my site: mysite.com.ar it throws me an authentication error, since it is also the path of the dashboard. so the checkAuth returns a reject and redirects to / login. But it is the first time that the user enters, what I want is for the landingPage to be mysite.com.ar. and that it automatically redirects to mysite.com.ar/login. The problem is that as I detail previously I use permissions to access different resources, if you don't have resources, then I must resolve [[]], otherwise it doesn't work. The links I declare in customRoutes all redirect to / login automatically. Any solution? there has to be some general way to solve this. Clarification: my project is developed with firebase, with the react-admin-firebase library |
My App.js is
and my customRoutes.js is
|
To test the error, you must enter https://simplecomercio.tk, what happens is that when you are in that path, you do not have permissions, so when you log in, you enter the case |
I think you just need to upgrade to 3.14.2 (see #6112). also: this is an English tracker. Even though some of us speak other languages, for the sake of the community, only English is accepted. |
Update packege-lock.json to the latest version. The problem persists. One time more, if i do this: If i do this: And if I do this: What I want is to enter http://localhost:3000/#/ and not return an error when redirecting to http://localhost:3000/#/login (because in this case I should not do the check in checkAuth). At the same time I want the customRoutes links to continue working. thanks for reading my concerns. |
This is really a "how to" question and not a bug request. So I'm closing the issue here, please continue the discussion on StackOverflow. |
I'm having the same issue. The problem comes when I'm also getting this message in the console when I try to go to a
codesandbox.io/s/epic-kepler-cii3c
|
#5036 and #4821 are the same problem.
It turns out that I want to have the routes created in customRoutes without authentication, but when I add the permissions to the pages with authentication, the pages without authentication are automatically redirected to the login, without showing me any of the customRoutes pages.
I tried returning some resource outside the permissions and it works, so the error is there, you have to return something without necessarily permissions, otherwise it is redirected immediately to the login. Any idea how to keep the permissions and routes scheme in customRoutes without authentication (as I show in my code) and that I can access the routes declared in customRoutes?
The text was updated successfully, but these errors were encountered: