Unable to access custom routes with resource permissions when not authenticated
See original GitHub issueWhat you were expecting:
A custom route, like /forgot-password
should be accessible without permissions.
What happened instead:
Redirects to /login
when not authenticated.
Steps to reproduce:
When <Resource>
s are declared as
<Admin customRoutes={[✂️]}>
{(permissions) => [
<Resource />
]}
</Admin>
getPermissions()
gets executed, which will, when it rejects, call logout()
, making it impossible to tell React Admin to not to redirect to the loginUrl but stay on the custom route.
This is not the case when permissions are not exposed to the <Resource>
s as initializeResources()
isn’t called, so this works as advertised:
<Admin customRoutes={[✂️]}>
<Resource />
</Admin>
Related code: See above.
Other information: This, apparently, wasn’t the case with 2.x, so I decided not to reopen #3224.
Environment
- React-admin version:
3.0.3
- Last version that did not exhibit the issue (if applicable):
2.???
- React version:
16.12.0
- Browser: Not browser-specific
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Unauthenticated custom routes not working when using a ...
Make the App's children a function that accepts permissions; Go to any custom route unauthenticated; You'll be redirected to the login page.
Read more >Troubleshooting access denied error messages - AWS Identity ...
Most access denied error messages appear in the format User user is not authorized to perform action on resource because context .
Read more >Troubleshoot permission and security issues - ASP.NET
This article describes how to troubleshoot common permissions and security-related issues in ASP.NET.
Read more >Authorization - Laravel - The PHP Framework For Web Artisans
If the action is not authorized or if no user is currently authenticated, Laravel will automatically throw an Illuminate\Auth\Access\AuthorizationException ...
Read more >Troubleshoot Cloud Run issues
Container failed to start; Internal error, resource readiness deadline ... 403 Forbidden Your client does not have permission to get URL from this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hm, I think I might have missed something, so I’ll reopen when I can figure out what’s off…