# userHasAuthenticated is not a function

**URL:** <https://discourse.sst.dev/t/userhasauthenticated-is-not-a-function/1468>\
**Category:** General\
**Created:** [November 30, 2019, 2:23am UTC](https://discourse.sst.dev/t/userhasauthenticated-is-not-a-function/1468 "2019-11-30T02:23:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![easiruwa](https://avatars.discourse-cdn.com/v4/letter/e/4bbf92/32.png) [@easiruwa](https://discourse.sst.dev/u/easiruwa)\
**Post date:** [November 30, 2019, 2:23am UTC](https://discourse.sst.dev/t/userhasauthenticated-is-not-a-function/1468/1 "2019-11-30T02:23:58Z")

</div>

I’m loving this guide so far! I’ve come to the ‘Add the Session to the State’ section but after following all the steps, and after logging in, I’m getting an error that says “userHasAuthenticated is not a function”. I’m not sure what else to do. I tried looking at other forums that were dealing with the same issue but they forgot to add childProps to which I can’t find reference to in the guide so doesn’t really help me. Any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![jayair](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/jayair/32/9_2.png) [@jayair](https://discourse.sst.dev/u/jayair)\
**Post date:** [December 16, 2019, 1:19am UTC](https://discourse.sst.dev/t/userhasauthenticated-is-not-a-function/1468/2 "2019-12-16T01:19:36Z")

</div>

If you are still having this issue can you post the code for the component that is generating the error?

---

<div class="post-metadata">

**Author:** ![easiruwa](https://avatars.discourse-cdn.com/v4/letter/e/4bbf92/32.png) [@easiruwa](https://discourse.sst.dev/u/easiruwa)\
**Post date:** [December 19, 2019, 3:25am UTC](https://discourse.sst.dev/t/userhasauthenticated-is-not-a-function/1468/3 "2019-12-19T03:25:04Z")

</div>

The login component is generating the error. Not sure what I’m doing wrong.

```
export default function LoginComp(props) {    

    const [email, setEmail] = useState("");
    const [password, setPassword] = useState("");
    

    function validateForm() {
        return email.length > 0 && password.length > 0;
    }

    async function handleSubmit(event) {
        event.preventDefault();
      
        try {
          await Auth.signIn(email, password);
          props.userHasAuthenticated(true);
          props.history.push("/dashboard");
        } catch (e) {

            console.log("finished printing");
            alert(e.message);
        }
      }
```

---

<div class="post-metadata">

**Author:** ![jayair](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/jayair/32/9_2.png) [@jayair](https://discourse.sst.dev/u/jayair)\
**Post date:** [January 12, 2020, 3:07am UTC](https://discourse.sst.dev/t/userhasauthenticated-is-not-a-function/1468/4 "2020-01-12T03:07:08Z")

</div>

Whats the error you are getting?

---

<div class="post-metadata">

**Author:** ![SeanMcTernan](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/seanmcternan/32/973_2.png) [@SeanMcTernan](https://discourse.sst.dev/u/SeanMcTernan)\
**Post date:** [September 18, 2020, 9:54pm UTC](https://discourse.sst.dev/t/userhasauthenticated-is-not-a-function/1468/5 "2020-09-18T21:54:32Z")

</div>

@easiruwa - Did you ever find a resolution to this? I am getting the same error. Similarly, in other topics I see reference to “childProps={childProps}”. I can only assume this is from an outdated version.

Similar to you, I get the error after I log in with correct credentials. The error is coming from the catch block in the HandleSubmit function:

} catch (e) {  
alert(e.message);  
}

localhost300 says:  
userHasAuthenticated is not a function

---

<div class="post-metadata">

**Author:** ![jayair](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/jayair/32/9_2.png) [@jayair](https://discourse.sst.dev/u/jayair)\
**Post date:** [October 15, 2020, 6:36pm UTC](https://discourse.sst.dev/t/userhasauthenticated-is-not-a-function/1468/6 "2020-10-15T18:36:50Z")

</div>

There have been updates to that part of the guide. You can compare your setup to the one in the repo:

> **[AnomalyInnovations/serverless-stack-demo-client](https://github.com/AnomalyInnovations/serverless-stack-demo-client)**
>
> Source for the demo app client in Serverless-Stack.com - AnomalyInnovations/serverless-stack-demo-client
