# Unable to create user and log in with auth0-node

**URL:** <https://community.auth0.com/t/unable-to-create-user-and-log-in-with-auth0-node/101613>\
**Category:** Get Help\
**Tags:** user-password-management, user-management\
**Created:** [March 2, 2023, 8:05am UTC](https://community.auth0.com/t/unable-to-create-user-and-log-in-with-auth0-node/101613 "2023-03-02T08:05:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eob](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/eob/32/45057_2.png) [@eob](https://community.auth0.com/u/eob)\
**Post date:** [March 2, 2023, 8:05am UTC](https://community.auth0.com/t/unable-to-create-user-and-log-in-with-auth0-node/101613/1 "2023-03-02T08:05:53Z")

</div>

I am getting `Unauthorized` errors when I try to create a user and then log in via NodeJS.

```auto
var auth = new auth0.AuthenticationClient({
    clientId: process.env.AUTH0_CLIENT_ID,
    domain: auth0Domain
});

const email = "..";
const password = "..";
const connection = ".."

const userCreateResult = await auth.database.signUp({email, password, connection})

// This fails
const authResult = await auth.oauth.passwordGrant({
    username: email,
    password,
    realm: connection
});

```

The error message us: **Unauthorized**

A few notes:

- I’ve tried both the “Web App” and the “Machine-to-Machine App”… Both fail.
- The Token Endpoint Authentication Method is POST
- The Password Grant type is enabled

I noticed in the web view that the User record which results does not appear to have my application listed as authorized – could that be related? And how do I use the NodeJS management client to add that?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [March 6, 2023, 9:19pm UTC](https://community.auth0.com/t/unable-to-create-user-and-log-in-with-auth0-node/101613/3 "2023-03-06T21:19:32Z")

</div>

Hi @eob,

Welcome to the Community!

If you are seeing a user in the dashboard, it is unlikely you are getting that error when you try to create the user as you’ve stated.

Can you confirm which request is causing the error? It may also be helpful to post the error in its entirety.

---

<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:** [April 24, 2023, 1:47pm UTC](https://community.auth0.com/t/unable-to-create-user-and-log-in-with-auth0-node/101613/4 "2023-04-24T13:47:53Z")

</div>

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