# React Router 6 Private route + Auth0

**URL:** <https://community.auth0.com/t/react-router-6-private-route-auth0/59353>\
**Category:** Get Help\
**Tags:** jwt, login, auth0\
**Created:** [March 12, 2021, 11:39pm UTC](https://community.auth0.com/t/react-router-6-private-route-auth0/59353 "2021-03-12T23:39:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rezamt](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rezamt/32/21334_2.png) [@rezamt](https://community.auth0.com/u/rezamt)\
**Post date:** [March 12, 2021, 11:39pm UTC](https://community.auth0.com/t/react-router-6-private-route-auth0/59353/1 "2021-03-12T23:39:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [March 15, 2021, 7:38pm UTC](https://community.auth0.com/t/react-router-6-private-route-auth0/59353/3 "2021-03-15T19:38:07Z")

</div>

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](https://auth0.com/blog/complete-guide-to-react-user-authentication/?_ga=2.135200761.97902719.1615807267-1595415333.1607347674) uses React Router 5, so you’d need to adjust the code by following a migration guide such as [Upgrade to React Router V6](https://morioh.com/p/995f1244f33b#upgrade-to-react-router-v6).

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 31, 2021, 6:35pm UTC](https://community.auth0.com/t/react-router-6-private-route-auth0/59353/4 "2021-03-31T18:35:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dan-auth0](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dan-auth0](https://community.auth0.com/u/dan-auth0)\
**Post date:** [February 9, 2022, 2:32am UTC](https://community.auth0.com/t/react-router-6-private-route-auth0/59353/5 "2022-02-09T02:32:54Z")

</div>

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

> **[React Router 6 Code Sample: Basic Authentication](https://developer.auth0.com/resources/code-samples/spa/react/basic-authentication)**
>
> Code sample showing how to protect a simple React single-page application using React Router 6, Auth0, and JavaScript.

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

---

<div class="post-metadata">

**Author:** ![dan-auth0](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dan-auth0](https://community.auth0.com/u/dan-auth0)\
**Post date:** [January 6, 2023, 1:21am UTC](https://community.auth0.com/t/react-router-6-private-route-auth0/59353/6 "2023-01-06T01:21:45Z")

</div>

You can also consult our newly released [React Authentication By Example: Using React Router 6](https://developer.auth0.com/resources/guides/spa/react/basic-authentication) 🎉 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`.
