Auth0 Home Blog Docs

"Invalid property user_id" when using tickets/password-change endpoint

user_id
password-change
tickets

#1

I’m using the following function to send a password reset email:

function passwordReset(userId, email) {
  var options = {
    method: 'POST',
    url: 'https://.../api/v2/tickets/password-change',
    headers: { authorization: 'Bearer ' + token },
    body: {
      result_url: '...',
      user_id: userId,
      new_password: 'secret',
      connection_id: '...',
      email: email,
      ttl_sec: 0
    },
    json: true
  };

  request(options, function (error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
  });
}

I’m pretty sure that:

  • The token is correct. I’m using the same one for tickets/email-verification endpoint and it works ok,
  • The userId is copied from your dashboard and it works with tickets/email-verification endpoint
  • I have correctly setupped a client (granted proper permissions) and connection. I got the connection id from the /connections endpoint.
  • The email is also correct

Using the same token and user id I am able to use tickets/email-verification and connections endpoints.

However with tickets/password-change I’m getting the following

{ statusCode: 400,
  error: 'Bad Request',
  message: 'Payload validation error: \'Invalid property user_id\'.',
  errorCode: 'invalid_body' }

#2

Hi @krasimir

I tried to test the issue using postman, and yes I am also facing it.
But as per my understanding, the error says that there is some problem with the body params and not the token.
It states that the service doesn’t recognize user_id as a body param.

When I tried the same request without the user_id field, I received the ticket positively.
Thus, let us wait for some experts @jmangelo to comment about this or you can continue using it excluding the user_id field.

Thanks!


#3

Yep, when I remove the user_id from the request it works and that satisfies our use case. So all good for now. Thanks.