# React Native Android - useAuth0 Hook not updating user after successful auth

**URL:** <https://community.auth0.com/t/react-native-android-useauth0-hook-not-updating-user-after-successful-auth/117565>\
**Category:** Get Help\
**Tags:** react-native-auth0, sdks-quickstarts\
**Created:** [October 2, 2023, 2:42pm UTC](https://community.auth0.com/t/react-native-android-useauth0-hook-not-updating-user-after-successful-auth/117565 "2023-10-02T14:42:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![william\_davis](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@william\_davis](https://community.auth0.com/u/william_davis)\
**Post date:** [October 2, 2023, 2:42pm UTC](https://community.auth0.com/t/react-native-android-useauth0-hook-not-updating-user-after-successful-auth/117565/1 "2023-10-02T14:42:53Z")

</div>

On an iPhone 14 Pro, I have no issues. On an LG V30 (as well as a Pixel 5 emulator), this issue occurs. What’s happening is on Android, I tap login (which is just a Pressable that triggers the login func below), I am prompted to enter creds, I get a successful login in the Auth0 console, but I do not redirect because `user` is still null from the `useAuth0` hook. I click login again (sometimes twice more) and eventually I am redirected and a successful exchange log appears in the Auth0 console.

react-native: 0.71.8  
react-native-auth0: 2.17.4

Here is my code:

```javascript
    const { authorize, user, isLoading, error } = useAuth0();

    useEffect(() => { // this doesn't fire until login (below) fires at least once more
        if (user !== undefined && user !== null) {
            setIsLoadingAuth(true);
            const userType = user["https://mysite.com/userType"];
            const userId = user["https://mysite.com/internalUserId"];

            userStore.setUserId(userId);
            userStore.setUserType(userType);
            userStore.createUser();
            userStore.user.setEmail(user["email"]);

            setIsLoadingAuth(false);
        }
    }, [user]);

    const login = async () => {
        setIsLoadingAuth(true);
        try {
            await authorize({
                scope: "offline_access",
                audience: "https://mysite.com/",
            });
            // error gets populated here: {"error": "a0.session.user_cancelled", "error_description": "User cancelled the Auth"}
        } catch (e) {
            console.log(e); // no error here
        }

        setIsLoadingAuth(false);
    };

```

---

<div class="post-metadata">

**Author:** ![william\_davis](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@william\_davis](https://community.auth0.com/u/william_davis)\
**Post date:** [October 2, 2023, 2:44pm UTC](https://community.auth0.com/t/react-native-android-useauth0-hook-not-updating-user-after-successful-auth/117565/2 "2023-10-02T14:44:17Z")

</div>

I should add that there is no error in the `catch` block of the call to `authorize`.

---

<div class="post-metadata">

**Author:** ![william\_davis](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@william\_davis](https://community.auth0.com/u/william_davis)\
**Post date:** [October 2, 2023, 3:41pm UTC](https://community.auth0.com/t/react-native-android-useauth0-hook-not-updating-user-after-successful-auth/117565/3 "2023-10-02T15:41:34Z")

</div>

This was caused by a configuration issue with `scheme` and `customScheme`, I solved using this GH comment: [Android redirection is broken · Issue #613 · auth0/react-native-auth0 · GitHub](https://github.com/auth0/react-native-auth0/issues/613#issuecomment-1520967859).

---

<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 16, 2023, 3:42pm UTC](https://community.auth0.com/t/react-native-android-useauth0-hook-not-updating-user-after-successful-auth/117565/4 "2023-10-16T15:42:14Z")

</div>

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