Support Topics Documentation Slack YouTube Blog

How to check if user password is correct?

(Avery Choke) #1

It doesn’t seems to be any API in Backendless to check the validity of password aside from login and reset password. I would like to allow a logged in user to change his email or name by having him to enter the password of the account. If the password is correct then only proceed with the update. Is there any method to do so?

(Vladimir Upirov) #2

Hey Avery

I’m sorry but now we don`t have this functionality.
But I can propose to you a some workaround.
You can do that via BusinessLogic through APIService

class UserSecurity {

   * @param {String} userIdentity
   * @param {String} userPassword
   * @returns {Boolean}
  isUserPasswordValid(userIdentity, userPassword) {
    const onLogin = () => { 
        return true

    return Backendless.UserService
    			.login(userIdentity, userPassword)
    			.then(onLogin, () => false)


And the where you want you can call the apiService with (userIdentity, userPass) params, and check if user input correct password

Regards, Vlad

(Vitaly Vengrov) #3

Custom event handler also should work

//server code
Backendless.ServerCode.customEvent('validatePassword', function(req) {
return Backendless.UserService.login(req.args.login, req.args.password).then(
() => true,
() => false
//client code
function validatePassword(login, password) {
return Backendless.Events.dispatch('validatePassword', { login, password });