DEV Community

Discussion on: How to manage user authentication With React JS

Collapse
 
petergfernandez profile image
Peter Fernandez

Building user authentication and authorization oneself, as part of the development of a project, is an option. And articles like this are a fantastic resource for showing you how; nice work @miracool 😎 However building user authentication and authorization when it's not ones core focus can lead to a whole lot of unnecessary work - that can also open an application to some unwanted and undesirable security implications. Check out my DEV post here to see how integrating with a SaaS platform - such as Auth0 - can be beneficial for a whole host of reasons 🤗

Collapse
 
xsmobi profile image
Eckard Ritter

Hello Peter,

I have come to this post because I was looking for a solution for a react app, deployed with Netlify, that is easier than with Auth0. The test on localhost works fine. The application is a Single Page Application on Auth0. But now, when I want to use Autho0 for the web version, it becomes rather complicated. On Netlify, I read that I have to create a Machine to Machine application - and its getting complicated.
Therefore I am looking for a solution described here, relying on the power of React.

You write: "However building user authentication and authorization when it's not ones core focus can lead to a whole lot of unnecessary work". And exactly this is my impression with Auth0. I recommend, take the time and read documentation of Netlify & Auth0 with the eyes on someone with no core focus on that stuff.

Best,
Eckard

Collapse
 
petergfernandez profile image
Peter Fernandez

Hi Eckard,

Thanks for reaching out 😎

I'm glad to hear you've found integrating your React SPA with Auth0 works well - at least on localhost - however, I am sorry to hear you're facing some challenges when using Netlify. I'm not an expert with Netlify per se, but I would recommend you check out our Netlify getting started guides on the Auth0 Developer Centre: developer.auth0.com/resources/get-.... In particular, the Build your Web Store with React, Auth0, Stripe and Netlify video (with Ben Dechrai, ex Auth0) does a great job of showing you how to integrate Auth0 as part of a React application deployed to Netlify.

I'm also not sure which documentation you read concerning the creation of a Machine-to-Machine (M2M) application 🤔 But I'm guessing it might be the documentation on Netlify that's currently marked as "in beta"? I.e: docs.netlify.com/integrations/auth...? Correct? A Machine-to-Machine application is typically one where there is no user interaction; using the OAuth 2.0/OIDC Client Credentials grant, this is where an application would call an API - such as the Auth0 Management API - in what is a machine-level context.

If you do still find yourself struggling, please feel free to post over in our Community Forum (community.auth0.com/) and mention me in any question you post. Hopefully, we can get you up and running ASAP....and also share what we find with others who may be facing a similar challenge?!

All the best
Peter

Thread Thread
 
xsmobi profile image
Eckard Ritter

the documentation on Netlify that's currently marked as "in beta"?
Yes. Thank you!

Thread Thread
 
xsmobi profile image
Eckard Ritter

Finally, I managed to create a M2M application. But on Netlify it was not possible the configure it. The page URL looks like app.netlify.com/sites/xxxxx/integr...

Under this headline
Auth0 by Okta
Easily integrate your Auth0 tenants with Netlify.
Configuration

I did the prefix: REACT_APP_

I selected my tenant

But under
Configure Tenant - dev-t927qb8a
Manage Apps

It was not possible to select the respective app. The select menu did not show me this one. Seemlingly it only showed Single Page Apps but not M2M apps

The end of the story is: I cannot do this. Even if it had worked out now, I think, I cannot use it because I need a clear, reproducible path.