scotthovestadt / gigya

Gigya JavaScript REST SDK
MIT License
38 stars 61 forks source link

accounts.resetPassword seems to be outdated #43

Open bmxpiku opened 4 years ago

bmxpiku commented 4 years ago

https://developers.gigya.com/display/GD/accounts.resetPassword+REST

You are required to pass only one of the parameters either loginID or passwordResetToken. If passwordResetToken is passed then the newPassword parameter is also required.

and currently interface looks like this:

export interface AccountsResetPasswordParams {
    loginID: string;
    passwordResetToken: string;
    newPassword: string;
    secretAnswer: string;
    securityFields: string;
    email?: string;
    lang?: string;
    sendEmail?: string;
}

so creating API action like this is not possible:

const options ={
loginID: 'mail@example.com',
sendEmail: false,
}
const token = await gigya.accounts.resetPassword(options);
if (token.statusCode !== 200) {
      throw Error('message');
    }
const responseReset = await gigya.accounts.resetPassword({
      sendEmail: false,
passwordResetToken: token.passwordResetToken,
newPassword: password,
    });
if (responseReset.statusCode === 200) {
      return 'success';
    }

Could you please update interface?

kiranjthomas commented 4 years ago

i just ran into this issue today. are there any plans to address updating the interface?

per Gigya's documentation, two calls to resetPassword are required. in the first call, gigya just needs loginID.