Preflight response is not successful error is thrown while I try to get the current user,
email id using the wix-user API .
Can someone help.
This is my code.
import wixUsers from ‘wix-users’;
//import wixUsers from ‘wix-users-backend’;
//var userEmail; $w.onReady( function ()
{ let user = wixUsers.currentUser;
let userId = user.id ; // “r5cme-6fem-485j-djre-4844c49”
let isLoggedIn = user.loggedIn; // true
user.getEmail() .then( (email) => {
let userEmail = email; // "user@something.com "
$w(" #text21 ").text=userEmail; } );
});
Thank You !