# I am stuck in strange error. I am trying to protect my client side route. I have this code

**URL:** <https://community.auth0.com/t/i-am-stuck-in-strange-error-i-am-trying-to-protect-my-client-side-route-i-have-this-code/9005>\
**Category:** Get Help\
**Tags:** authentication\
**Created:** [December 17, 2017, 6:09pm UTC](https://community.auth0.com/t/i-am-stuck-in-strange-error-i-am-trying-to-protect-my-client-side-route-i-have-this-code/9005 "2017-12-17T18:09:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![restlessankur](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@restlessankur](https://community.auth0.com/u/restlessankur)\
**Post date:** [December 17, 2017, 6:09pm UTC](https://community.auth0.com/t/i-am-stuck-in-strange-error-i-am-trying-to-protect-my-client-side-route-i-have-this-code/9005/1 "2017-12-17T18:09:21Z")

</div>

Now, i go to login page, click login, it comes back to login page . But, when i dont protect this route and I have it unprotected

It works perfectly and after login, i go to this Apphome component.

I am using react.js and auth0 . What’s the issue here?

Thanks in advance

```
<Router history={history} component={App}>
      <div>

        <Route path="/login" render={(props) => <Login auth={auth} {...props} />} />
        
        <Route path="/apphome" render={(props) => (
              !auth.isAuthenticated() ? (
                <Redirect to="/login"/>
              ) : (
                <Apphome auth={auth} {...props} />
              )
            )} />
        <Route path="/contacts" exact component ={Contacts} />
        <Route path="/mytodo" exact component ={Mytodo} />
        <Route path="/favorites" exact component ={Favorites} />
        <Route path="/mention" exact component ={Mention} />
        <Route path="/profile" exact component ={Profile} />
        <Route path="/buy" exact component ={Buy} />
        <Route path="/success" exact component ={Success} />
        <Route path="/cancel" exact component ={Cancel} />

      </div>
    </Router>

```

---

<div class="post-metadata">

**Author:** ![restlessankur](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@restlessankur](https://community.auth0.com/u/restlessankur)\
**Post date:** [December 17, 2017, 8:25pm UTC](https://community.auth0.com/t/i-am-stuck-in-strange-error-i-am-trying-to-protect-my-client-side-route-i-have-this-code/9005/2 "2017-12-17T20:25:19Z")

</div>

I see this code in documentation

```
<Route path="/ping" render={(props) => (
  !auth.isAuthenticated() ? (
    <Redirect to="/home"/>
  ) : (
    <Ping auth={auth} {...props} />
  )
)} />

```

Now, I have seperate login page with login route.

```
  <Route path="/apphome" render={(props) => (
              !auth.isAuthenticated() ? (
                <Redirect to="/login"/>
              ) : (
                <Apphome auth={auth} {...props} />
              )
            )} />

```

Now, if i try to open /apphome . It works correctly , unauthenticated user goes to login component. However, if i try to login, after login I go back to login page.

In my local storage, I have this

key . - com.auth0.auth.rRudUuEGZ2q3UEe3pH8aFOMwg-7va9fU

value - {“nonce”:“BE.Xm4eforMn2wPSgDle1wx\_nEYCVPV9”,“state”:“rRudUuEGZ2q3UEe3pH8aFOMwg-7va9fU”}

Can someone tell me, whats the error here?

---

<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 2, 2018, 5:57am UTC](https://community.auth0.com/t/i-am-stuck-in-strange-error-i-am-trying-to-protect-my-client-side-route-i-have-this-code/9005/3 "2018-03-02T05:57:50Z")

</div>


