The Complete Guide to React Authentication with Auth0

I can not get this work for the life of me. I get the login/signup to run and then once I signup I am redirected back to the home page with this as the url:

http://localhost:4040/?error=access_denied&error_description=Invalid%20URI%20"https%3A%2F%2F%2F%3Cyour-app-domain%3E%2Fv1alpha1%2Fgraphql"&state=d0UyRDZXdG9EcGFQZ2QzODltQlcuME01OHY1MXRzUG9Da3FRZVFIdTlCdg%3D%3D

console shows no errors and I’ve searched the entire directory for “you-app-domain” to no avail, subsequently clicking on “Log In” just refreshes the page.

I’ve also switched to the main branch thinking that maybe I messed up with my code and its still not working. React Dev tools are showing the correct clientId and domain in the component.

Edit*** Figured it out, it was one of the rules I had made for connecting with Hasura. Is there a way to make rules only apply to a single app?

Hi @dpn.nolan,

You can make a rule app-specific by adding a check for the context.clientName at the beginning of your rule like this:

function ruleForSpecificApp(user, context, callback) {
  // only run rule for NameOfTheApp
  // bypass this rule for all other apps
  if(context.clientName !== 'NameOfTheApp'){
    return callback(null, user, context);
  }
 
  // add rule logic here

  return callback(null, user, context);
}
2 Likes

Great article - perhaps the best I’ve seen to date to get started. That said, where can I find an example that uses a custom login page?

1 Like

@dan-auth0 Kudos on a great guide to React Auth, well written and explained!

Has there been any update on a Role-Based Access Control guide with the new SDK? I tried to follow the outdated article you put up on the subject before but was outdated with what I have at the moment.

My use case is for a SAAS app where there a few admin users for the app as a whole. The app can then be used by different organisations where each organisation has different roles that are restricted to certain components.

1 Like

Welcome to the Auth0 Community, Gregory! Thanks for reading the blog post and for your feedback.

I have in my backlog to create a guide on how to create a custom page. What type of customization are you looking to accomplish and to what extent?

1 Like

Be welcomed to the Auth0 Community, Tom! I have been doing extensive research on the RBAC solution that Auth0 offers and finding out the best use cases to which it applies. I am currently working on a project that will make it easier to share this type of knowledge with our developer community. Next week, I’ll be working on the RBAC draft for React.

What I have right now relies entirely on roles. Do you think that your multi-organization use case could still be fulfilled with roles only or would you need to access user permissions discretely in the client application?

2 Likes

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)