Cannot login using a customized form

Hello everyone.
I’m using Wix Editor on Windows. I want to build a custom login form using a regular page, instead of the LIghtbox Login form offered by Wix.
The login in is not happening successfully and I can’t figure out why. A bit of help would be super appreciated.

The end result of this code is: “Member is not logged in” and there is no redirection
The desired end result would be “Member is logged in” and then redirect to /newclaim

This is the code for the back-end function used for the login:

import wixMembersBackend from 'wix-members-backend';

export function kinkiLogin(email, password) {

    let data = {};

    return wixMembersBackend.authentication.login(email, password)
        .then((sessionToken) => {
            data.token = sessionToken;
            data.approved = true; 
            return data;
        .catch((error) => {	
            data.original = error;
            data.errCode = error.details.applicationError.code;
            data.errText = error.details.applicationError.description;
            data.token = undefined;
            data.approved = false;	
            if(error.details.applicationError.code === '-19999') {
                data.errReason = 'email not found';
            if(error.details.applicationError.code === '-19956') {
                data.errReason = 'member blocked';
            return data;

And this is the front-end code:

import { kinkiLogin } from 'backend/kinkiLoginFile.jsw';
import { authentication } from 'wix-members-frontend';
import wixLocationFrontend from 'wix-location-frontend';

// Top-level listener for login
authentication.onLogin(async (member) => {'/newclaim');

$w.onReady(function () {

	kinkiLogin('', 'example.password')      // I write here the correct email and password manually for testing purposes 

      .then(() => {
        // Successful login actions
        const isLoggedIn = authentication.loggedIn();
        if (isLoggedIn) {
        console.log('Member is logged in');
        } else {
        console.log('Member is not logged in');

      .catch((err) => {
        $w('#errorMessage').text = "Login failed: " + err.message;

So the backend function only does half the login process. It returns a sessionToken that then needs to be returned to the frontend and applied with applySessionToken.

So something like applySessionToken(data.sessionToken) should work here when used in the kinkiLogin.then() handler.

looks like it could be some code of my own :rofl:
like that code-structure.

That’s because it’s your code xD I took it from another forum answer of yours

Thanks a million guys. Finally I’m using the frontend option to login and it’s working fine.

I knew it. I can smell my own coding structure :rofl:

Good luck and happy coding!