Userbase

Docs : SDK : init

init needs to be the very first thing you call in your web app. It initializes the SDK with your App ID, and it also handles automatic logins when users return to your web app with an active session.

    userbase.init({ appId })
      .then((session) => {
        // SDK initialized successfully
        
        if (session.user) {
          // there is a valid active session
          console.log(session.user.username)
        }
      })
      .catch((e) => console.error(e))
    
  

Parameters

Result

Errors