React Router 6 Private route + Auth0

Hi Auth0 Community
I am trying to integrate Auth0 with a recently developed app based on React Router 6. Do you have any material or guideline for React Router 6 and how to create private Route on that ?

I am planning to use Auth0 for all our Authentication requirments.

Thanks
Reza

Hi @rezamt,

Welcome to the Community!

Unfortunately, I don’t believe we currently have a guide that uses React Router 6. The Complete Guide to React User Authentication with Auth0 uses React Router 5, so you’d need to adjust the code by following a migration guide such as Upgrade to React Router V6.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.

@rezamt I created a code sample for React Router 6 + React 17:

I’d like to invite you to try it out, please :slight_smile: I will be gathering feedback to then build the new React Authentication guide based on it :eyes:

1 Like

You can also consult our newly released React Authentication By Example: Using React Router 6 :tada: for guidance on how to integrate Auth0 with a React Router v6 application. While the guide uses React v18, the same architecture would apply to an app that uses React v17.