# Problem with login in browsers like Safari, Firefox, Brave

**URL:** <https://community.auth0.com/t/problem-with-login-in-browsers-like-safari-firefox-brave/116696>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [September 20, 2023, 8:56am UTC](https://community.auth0.com/t/problem-with-login-in-browsers-like-safari-firefox-brave/116696 "2023-09-20T08:56:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alfred1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alfred1/32/48806_2.png) [@alfred1](https://community.auth0.com/u/alfred1)\
**Post date:** [September 20, 2023, 8:56am UTC](https://community.auth0.com/t/problem-with-login-in-browsers-like-safari-firefox-brave/116696/1 "2023-09-20T08:56:29Z")

</div>

I use the library

`"@auth0/auth0-react": "^2.2.1"`

I connect with the function loginWithPopup from the Auth0 hook: I can connect, but after refreshing the page I don’t receive a token with getAccessTokenSilently and need to connect again.

We use Cross-Origin Authentication.

This happens in browsers like Safari, Firefox, Brave.

My code:

```auto

import {useAuth0} from "@auth0/auth0-react";

const HomePage: FC = () => {
const {loginWithPopup} = useAuth0();
return (
<Button onClick={() => loginWithPopup()}>{'Login'}</Button>
)
}

```

also I don’t get user details: only user\_id (sub)

```auto
const { user } = useAuth0();

console.log(user) //{sub: 'google-oauth2|111490016442351871588'}

```

Also, I try to log in with API of Auth0.

As for the API, I’m using a library

`"auth0-js": "^9.22.1"`

In the same browsers I try to connect using functions like

```auto

import auth0 from "auth0-js";

export const webAuth = new auth0.WebAuth({
    domain: process.env.REACT_APP_AUTH0_DOMAIN as string,
    clientID: process.env.REACT_APP_AUTH0_CLIENT_ID as string,
    audience: process.env.REACT_APP_AUTH0_AUDIENCE as string,
    redirectUri: window?.location?.origin,
    responseType: 'token',
    scope: 'openid profile email read:current_user update:current_user_metadata offline_access',
});

const loginWithUsernamePassword = useCallback((data: TFormData) => {
        return new Promise((resolve, reject) => {
            webAuth.login({
                connection: DATABASE_CONNECTION,
                username: data.username,
                password: data.password,
                realm: DATABASE_CONNECTION,
                state: stateParam,
            } as CrossOriginLoginOptions, (error, result) => {
                if (error) {
                    console.log(error)
                    reject(error);
                    setErrorResponse(error.error_description || error.description || 'something went wrong')
                    return;
                }
                resolve(result);
            })
        })
    }, [webAuth]);

const loginWithGoogle = useCallback(() => {
        webAuth.authorize({connection: 'google-oauth2', redirectUri});
    }, [webAuth]);

```

and the connection doesn’t happen at all in both cases

What do I do wrong?

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [September 21, 2023, 10:58am UTC](https://community.auth0.com/t/problem-with-login-in-browsers-like-safari-firefox-brave/116696/3 "2023-09-21T10:58:52Z")

</div>

Hey there @alfred1 !

> [@alfred1](#):
>
> I can connect, but after refreshing the page I don’t receive a token with getAccessTokenSilently and need to connect again.

That would be, unfortunately, an expected behaviour for browsers which [technology](https://auth0.com/docs/troubleshoot/authentication-issues/renew-tokens-when-using-safari) diable storing 3d party cookies. When the user authenticates, auth0 server responds with the header: set cookie=(…) so that after a successful authentication, there are session related cookies sent from auth0 to the user browser and reused on each subsequent request to the /authorize to perform silent authentication on page refresh (works for chrome which by default doesn’t prevent this behaviour).

> We use Cross-Origin Authentication.

Because [cross-origin authentication](https://auth0.com/docs/authenticate/login/cross-origin-authentication) is achieved using third-party cookies, disabling third-party cookies will make cross-origin authentication fail. Some browsers, such as the newest version of Firefox, disable third-party cookies by default, meaning that cross-origin authentication will not work for users on Firefox. The only way to make embedded login work for Firefox users is to use a custom domain, as described below.

It looks like, if you care to work with an embedded authentication form, and rely on a silent authentication, the custom domain for your auth0 tenant would be a solution, but please take into account it’s a paid feature.

Alternatively, you can switch to using the auth0’s Universal login page (same domain during authentication) and using refresh token rotation instead of the silent authentication.

---

<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:** [October 5, 2023, 10:59am UTC](https://community.auth0.com/t/problem-with-login-in-browsers-like-safari-firefox-brave/116696/4 "2023-10-05T10:59:39Z")

</div>

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