Automatic Login

I’am making an educational website and the user should automatically login after clicking on a button. Can somebody help me wit this…

Try out:

import wixUsers from 'wix-users';

$w.onReady(() => {

  $w('#loginButton').onClick(login);
});

async function login() {

  try {
    const user = await wixUsers.login();
    
    console.log(`Welcome${user.name}!`);
  } catch (err) {
  
    console.log(err);
  }
}