auto login after registration possible?

I’m working with the javascript SDK and it doesn’t look like the user can be auto logged in after they register, is that correct?

Hi Chris,

Yes, that is correct, the login does not happen automatically. You need call the login method. One of the reasons for this is your backend may be configured to require email confirmation, which means the user account may not be ready for logins yet.

Regards,
Mark

Hello, we are in the process of migrating from Parse. On our parse app we did not require email authentication. So when a user signed up via email, they were automatically taken into the app. Does backendless support that same user flow if email verification is not required. Can we auto log users in immediately after signing up? It’s a poor user experience if they all of a sudden have to log in after just signing up. Thanks.

Just turn off email confirmation in backendless console and call method login user after register

Does something happen to the password value once you use a user object to register?

I’m calling the login method once successful registration is confirmed and its failing because the password property has a value of nil…

var userService = UserService()
            
        userService.registerUser(user) {registeredUser, error in
            if let registeredUser = registeredUser {
                print("user registered")
                print("user pw: \(self.user.password)")
                print("registered user pw: \(registeredUser.password)")


                
                userService.logUserIn(self.user) { loggedInUser, error in
                    if let loggedInUser = loggedInUser {
                        progressHUD.removeFromSuperview()
                        self.segue()
                        print("segue started")
                    } else if let error = error {
                        print("error")
                        progressHUD.removeFromSuperview()
                        showAlertPopup(self, titleText: "Error", messageText: error.detail)
                        print(error)
                    }
                }
                
            } else if let error = error {
                print("error")
                progressHUD.removeFromSuperview()
                showAlertPopup(self, titleText: "Error", messageText: error.detail)
                print(error)
            }
        }
class UserService {


    var backendless = Backendless.sharedInstance()


    func registerUser (user: BackendlessUser, completion: ( BackendlessUser?, Fault?) -> Void)
    {   
        backendless.userService.setStayLoggedIn(true)
        
        backendless.userService.registering(user,
            response: { (var registeredUser: BackendlessUser!) -> () in
                completion(registeredUser, nil)
            },
            error: { (var fault: Fault!) -> () in
                completion(nil, fault)
        } )
        
    }


    func logUserIn (user: BackendlessUser, completion: (BackendlessUser?, Fault?) -> Void)
    {        
        backendless.userService.setStayLoggedIn(true)
        
        backendless.userService.login(user.email, password: user.password,
            response: { (var loggedInUser: BackendlessUser!) -> Void in
                print("User has been logged in (ASYNC)")
                completion(loggedInUser, nil)
            },
            error: { (var error: Fault!) -> Void in
                print("Server error: \(error)")
                completion(nil, error)
            }
        )
    }

You can use the password from user registration response. You have to use the password that is provided by a user, that use your application.

Can you please clarify? Did you mean I cannot use the password from the registration response? I have to save the password locally then use it once once for registration and again for login?

You cannot use password from registration response. To make login after registration you have to save password(some where), that user provide to your app during registration, than use this password for login