My custom login code has stopped working. Error is thrown in the client side:
TypeError: Cannot read properties of undefined (reading ‘then’)
Anyone else facing custom login issues?
serverside code:-
import wixUsersBackend from ‘wix-users-backend’;
2
3export function myBackendFunction(email, password) {
4 return wixUsersBackend.login(email, password)
5 .then( (sessionToken) => {
6 return {sessionToken, “approved”: true};
7 } )
8 .catch( (error) => {
9 return {“approved”: false, “reason”: error};
10 } );
11}
Client side
import wixUsers from ‘wix-users’;
2
3// …
4
5wixUsers.applySessionToken(sessionToken)
6 .then( () => {
7 console.log(“User logged in.”);
8 } );
@tomoya
My custom login also stopped working, the same error appears, just like yours, in wixUsers.login
Anyone from wix can you please look into this? Some change at your end has broken the custom login feature, particularly the wixUsers.applySessionToken method.
Had raised a ticket with wix-support Yesterday, no response yet.
@marlowe-shaeffer @yisrael-wix
Hi Prashanth,
Can you please provide the URL for your site, steps to reproduce, and any other information to help us investigate? Thanks.
This issue should now be resolved. Please let us know if you continue to have any problems.
Thanks @marlowe-shaeffer Tested and works fine now.
The sessionToken is no longer returned in the RegistrationResult object
This is what my RegistrationResult looks like after calling wixUsersBackend.register , there used to be also a sessionToken.
“{"status":"Active","user":{"id":"649fb0b6-38d2-4271-bc82-7646ee75c5cb"}}”