Password Reset returning 400 - Docs are wrong

After following the code example on how to perform the password reset and debugging for quite some time, I discovered that the docs (examples and SDK docs) are incorrect. They both list the parameters as

resetPassword(password, token, tokenId)

when in actuality, the function is this:

async resetPassword(token, tokenId, password) {
    const appRoute = this.fetcher.appRoute;
    await this.fetcher.fetchJSON({
        method: "POST",
        path: appRoute.emailPasswordAuth(this.providerName).reset().path,
        body: { token, tokenId, password },
    });
}

I’m just posting this information for the benefit of others who might run into this in the future. Don’t know if the docs team will see this and get things updated.

Hi Justin!

I’m on the docs team here at MongoDB. Thanks for bringing this to our attention! We’ve actually fixed this in a feature branch where we’re putting together some other docs improvements: https://github.com/mongodb/docs-realm/blob/new-ia/source/sdk/node/examples/manage-email-password-users.txt#L231 … so expect the fix for this in the next week or so. You can also report issues like this using the docs feedback widget (the little “feedback” tab in the bottom right of docs pages) to tell us when you notice other discrepancies like this. We try our best to keep code snippets as accurate as possible, but occasionally issues do slip through the cracks, so we really appreciate it when users like you let us know about these things.

-Nate

2 Likes

Thanks, Nate! Glad you and the team were already on top of it. I’ll be sure to use the feedback feature in the future. Though I’d hate to give the doc a bad rating just for some incorrect code. Don’t want y’all getting yelled at because the code changed.

1 Like