Search code examples
httpherokuparse-servermlab

password reset (Parse-server/Heroku) -> {"error":"unauthorized"}


On an app (ParseServer) that I have with HEROKU/mLab, providing password reset for the user. After I click the link to reset my account password, I can only see this (in the browser):

{"error":"unauthorized"}

and am not able to reset my password as I should.

Does anyone know how to fix this problem?

For reference here is some code, which may be useful to better grasp the issue:

var api = new ParseServer({
  databaseURI: databaseUri,
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  masterKey: process.env.MASTER_KEY || '',
  serverURL: "https://myapp.herokuapp.com/parse",
  publicServerURL: 'https://myapp.herokuapp.com/parse',
  appName: 'TheApp',
  liveQuery: {
    classNames: ["Stuff_List"]
  },
  verifyUserEmails: true,
  emailAdapter: {
    module: '@parse/simple-mailgun-adapter',
    options: {
      fromAddress: 'sadguy@hmail.cor',
      domain: 'dmn.net',
      apiKey: process.env.EML_ADAPTER_KEY
    }
  }
});

Solution

  • I guess this could also happen to other people so I post the solution that I ended up finding. Hoping to avoid someone to lose a few hours like I did. The problem was in fact, rather basic (somewhat disappointing).

    The issue was the APP_ID. It is used as part of the URL the user receives (for password resetting), so if it contains weird characters, that you may have chosen to make the ID complicated. It will break the URL. I guess, if one chooses "abcd1234" there will be no problem at all. But you may want to have something different for other reasons. So one has to find a good balance, being careful about the characters used in APP_ID.

    Once I fixed that all went as expected.