# isAuthenticated is false after successful login with @auth0/auth0-react

**URL:** <https://community.auth0.com/t/isauthenticated-is-false-after-successful-login-with-auth0-auth0-react/61959>\
**Category:** Get Help\
**Tags:** react, auth0\
**Created:** [April 29, 2021, 1:43pm UTC](https://community.auth0.com/t/isauthenticated-is-false-after-successful-login-with-auth0-auth0-react/61959 "2021-04-29T13:43:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmhaskar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bmhaskar/32/29117_2.png) [@bmhaskar](https://community.auth0.com/u/bmhaskar)\
**Post date:** [April 29, 2021, 1:43pm UTC](https://community.auth0.com/t/isauthenticated-is-false-after-successful-login-with-auth0-auth0-react/61959/1 "2021-04-29T13:43:58Z")

</div>

Please include the following information in your post:

- **Which SDK this is regarding:** @auth0/auth0-react
- **SDK Version:** 1.0.3
- **Platform Version:** Node v15.11.0,
- **Code Snippets/Error Messages/Supporting Details/Screenshots:**

The authentication is part of storybook add-on.

```
 <QueryClientProvider client={queryClient}>
  <Auth0Provider
    domain={process.env.STORYBOOK_AUTH0_ISSUER_BASE_URL}
    clientId={process.env.STORYBOOK_AUTH0_CLIENT_ID}
    redirectUri={window.location.origin}

  >

    <Auth />
    

  </Auth0Provider>
</QueryClientProvider>

```

* * *

Auth.js

import React, {useEffect, useRef} from ‘react’  
import { useAuth0 } from ‘@auth0/auth0-react’;

const Auth = () =\> {  
const { isAuthenticated, loginWithRedirect, logout } = useAuth0();

console.log(isAuthenticated);

return isAuthenticated ? (  
\<button  
href=“#”  
color=“primary”  
variant=“outlined”  
onClick={() =\> logout({ ‘returnTo’: window.location.origin })}  
\>  
Logout  
  
) : (  
\<button  
href=“#”  
color=“primary”  
variant=“outlined”  
onClick={() =\> loginWithRedirect()}  
\>  
Login  
  
);  
};

 ![image](https://global.discourse-cdn.com/auth0/original/3X/b/b/bb2bb1378acefaf40616a1ea8ae4d55fc9241808.png)

 ![image](https://global.discourse-cdn.com/auth0/original/3X/1/f/1f9bfb44dd0f52cefdae1d176d045dd571078887.png)

There is an existing issue [isAuthenticated is false after successful login · Issue #82 · auth0/auth0-react · GitHub](https://github.com/auth0/auth0-react/issues/82) though closed not sure if anyone else is also facing same.

---

<div class="post-metadata">

**Author:** ![bmhaskar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bmhaskar/32/29117_2.png) [@bmhaskar](https://community.auth0.com/u/bmhaskar)\
**Post date:** [April 29, 2021, 1:59pm UTC](https://community.auth0.com/t/isauthenticated-is-false-after-successful-login-with-auth0-auth0-react/61959/2 "2021-04-29T13:59:54Z")

</div>

Addition info on API calls which run successfully

 ![image](https://global.discourse-cdn.com/auth0/original/3X/5/0/50f724bf0fa520ee0ec2da373e1c7a553ac59fac.png)

---

<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:** [April 29, 2021, 7:22pm UTC](https://community.auth0.com/t/isauthenticated-is-false-after-successful-login-with-auth0-auth0-react/61959/4 "2021-04-29T19:22:28Z")

</div>

Hi @bmhaskar,

I’m not too familiar with the storybook add-on, but it looks like the `/oauth/token` request is successful, so it seems like your settings are correct. I see that there is an error in the console, is that related to auth? Also, when you look at your tenant logs, do you see a failed silent auth or any other errors related to login? Thanks!

---

<div class="post-metadata">

**Author:** ![bmhaskar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bmhaskar/32/29117_2.png) [@bmhaskar](https://community.auth0.com/u/bmhaskar)\
**Post date:** [May 3, 2021, 5:06am UTC](https://community.auth0.com/t/isauthenticated-is-false-after-successful-login-with-auth0-auth0-react/61959/5 "2021-05-03T05:06:37Z")

</div>

There were few silent auth failures when tried from Safari, though I have added a custom domain to avoid any of those still the issue remains.

---

<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:** [May 3, 2021, 11:59am UTC](https://community.auth0.com/t/isauthenticated-is-false-after-successful-login-with-auth0-auth0-react/61959/6 "2021-05-03T11:59:19Z")

</div>

Thanks for clarifying that you are using a Custom Domain. Usually, silent auth will fail because third-party cookies are blocked, but if a Custom Domain is used, then the browser should not block the cookies since they shouldn’t be categorized as third-party. Have you adapted your app to use the Custom Domain? For instance, the `domain` in the `Auth0Provider` component should be that of your Custom Domain. Here is documentation for configuring Auth0 features to use a Custom Domain:

> **[Configure Features to Use Custom Domains](https://auth0.com/docs/customize/custom-domains/configure-features-to-use-custom-domains)**
>
> Learn how to configure a custom domain for Auth0 authentication features.

---

<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:** [June 25, 2021, 12:56pm UTC](https://community.auth0.com/t/isauthenticated-is-false-after-successful-login-with-auth0-auth0-react/61959/7 "2021-06-25T12:56:20Z")

</div>

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