Hello,
The function was working well until 4 or 5 days ago, I’ve realized that the site members was not able to login, I use a third party authentication and the login is fulfilled by the backend function wixUsers.generateSessionToken(email) , and wixUsers.applySessionToken(token) on the Frontend
I recreated it on a new wix site with a minimum code to show it:
/*******************************
* Backend code - wixTools.jsw *
*******************************/
import wixUsers from 'wix-users-backend';
export function getLoginToken(email) {
return wixUsers.generateSessionToken(email)
.then((sessionToken) => {
console.log("User session token is "+sessionToken);
return { "sessionToken": sessionToken, "approved": true };
}).catch(error => {
console.log("Backend getLoginToken Crash: " + error);
return { "approved": false, "error":error };
});
}
/*******************************
* Frontend code - NewPage *
*******************************/
import wixUsers from 'wix-users';
import { getLoginToken } from 'backend/wixTools'
$w.onReady(function () {
getLoginToken("demo@demo.com").then(result => {
if (result.approved) {
console.log("User sessionToken is: " + result.sessionToken);
wixUsers.applySessionToken(result.sessionToken)
.then(() => {
console.log("User logged in.");
});
}
})
});
There is no difference if the user (which already exist) status is Active (approved) or Applicant (pending) the function “generateSessionToken()” from “wix-users-backend” is always crashing like that (in both web sites I tested, production and test site):
The backend function"wixUsers.approveByEmail(email)" to approve pending members is also failing, Is this a bug?
If so could you please take a look at that, at the moment the users are not able to login and register on my site and it’s a l little bit painful.
Thanks and Regards