databse.signIn throws APIError

Good day,

we’re doing a “test drive” of your wonderful service, but we ran into an issue when we try to sign in a user.

We have a NodeJS service that is using your auth0 npm package (version ^2.37.0). We’re using this documentation: https://auth0.github.io/node-auth0/module-auth.DatabaseAuthenticator.html.

Thanks in advance!

Kind regards,
Valentin

Our code looks like this:

const client = new AuthenticationClient({
  domain: process.env.AUTH0_ACCOUNT,
  clientId: process.env.CLIENT_ID
});

let signUpCreds = {
  email: `test1@test.bg`,
  password: 'asd',
  connection: 'Username-Password-Authentication'
};

client.database.signUp(signUpCreds, (error, userData) => {
  // This actually creates a user in your system
});

let signInCreds = {
  username: `test1@test.bg`,
  password: 'asd',
  connection: 'Username-Password-Authentication'
};

client.database.signIn(signInCreds, (error, userData) => {
  // This throws an error
});

The error:


SanitizedError {
  name: 'APIError',
  message: '{}',
  statusCode: 404,
  requestInfo: { method: 'post', url: 'https://...auth0.com/oauth/ro' },
  originalError: Error: Not Found
      at Request.callback (.../node/index.js:879:15)
      at IncomingMessage.<anonymous> (.../node/index.js:1129:18)
      at IncomingMessage.emit (node:events:406:35)
      at endReadableNT (node:internal/streams/readable:1329:12)
      at processTicksAndRejections (node:internal/process/task_queues:83:21) {
    status: 404,
    response: Response {
      _events: [Object: null prototype] {},
      _eventsCount: 0,
      _maxListeners: undefined,
      res: [IncomingMessage],
      request: [Request],
      req: [ClientRequest],
      text: 'Not Found',
      body: {},
      files: undefined,
      buffered: true,
      headers: [Object],
      header: [Object],
      statusCode: 404,
      status: 404,
      statusType: 4,
      info: false,
      ok: false,
      redirect: false,
      clientError: true,
      serverError: false,
      error: [Error],
      created: false,
      accepted: false,
      noContent: false,
      badRequest: false,
      unauthorized: false,
      notAcceptable: false,
      forbidden: false,
      notFound: true,
      unprocessableEntity: false,
      type: 'text/plain',
      charset: 'utf-8',
      links: {},
      setEncoding: [Function: bound ],
      redirects: [],
      pipe: [Function (anonymous)],
      [Symbol(kCapture)]: false
    }
}

Hi @valentin.ge,

Welcome to the Auth0 Community!

I understand you have encountered errors logging in using the AuthenticationClient.

I am taking a look at this issue and will get back when I have more information.

Thank you.

1 Like

Thank you, kind sir!

A forgot to mention, that we tried to connect to Regular Web App and to Machine to Machine App. Currently, I left only the first app. I think I missed a configuration.

Thanks again!

1 Like

Hi @valentin.ge,

Thank you for your response and patience.

I have thoroughly tested the Authentication API and found that the auth0.database.signIn() method is calling the /oauth/ro endpoint, which is a legacy endpoint and replaced in favor of the Password Grant with oauth/token.

Given that, I can confirm that the error is to be expected and hence why the endpoint is not reachable.

In this case, you will need to use the Password Grant to authorize your user.

Please let me know if you have any questions or concerns.

Thanks!

1 Like

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