question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to access custom routes with resource permissions when not authenticated

See original GitHub issue

What 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:closed
  • Created 4 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
RWOverdijkcommented, Apr 9, 2020

image

1reaction
zeppelincommented, Jan 26, 2020

Hm, I think I might have missed something, so I’ll reopen when I can figure out what’s off…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found