wixLocation.to logs an error to console

I have the following code on my login page, login is triggered on click of the login button:

export async function login() {

let email = $w("#inputEmail").value;
let password = $w("#inputPass").value;

try {
   
    await authentication.login(email, password);
     wixLocation.to("/viewuserrequests");

} catch (e) {
    console.log(e);
}

}

The following logs an error to the dev console “ailed to parse redirect url: Error: Authorization redirect url missing
at G (utils.ts:422:9)
at w (utils.ts:389:28)
at b (utils.ts:376:29)
at login (siteMembersApi.ts:1623:24)
at async login (siteMembersSdkProvider.ts:47:13)
at async AsyncFunction. (platformWorkerInitializer.ts:59:13)”

When using the wixLocationFrontend.to() the page does not even change.

Is this a bug ? (I’m currently using a free site)

I’ve also tried to use:
" authentication.onLogin(() => { wixLocation.to(“/viewuserrequests”);})"
but get the same error.

Product:
[ Wix Studio Editor,]

That error doesn’t seem to be due to wixLocation.to(). Have it working here: https://anthonyl5.wixstudio.io/location-to

import wixLocationFrontend from 'wix-location-frontend';

$w('#button1').onClick(() => {
    wixLocationFrontend.to("/test");
})

Can you share any more details? Are the password/email correct? Is this on a live site or in preview mode?

Login is successful, otherwise catch() will be executed.
I’m testing a live site (not preview) but I do not have a domain (free wix plan).

I believe that since the target URL is a member page, wixLocationFrontend.to(“”) need to pass the auth token and I think this is the issue.

I have the same login logic in Editor-X on a premium site and using wixUsers instead of authenticate and it does not produce this error. I’ve tried using wixUser here as well and it still produce the same error.

this is the code with wixUsers:

$w.onReady(async function () {
    $w("#sectionSpinner").collapse();

    $w("#buttonLogin").onClick(login);
    $w("#textForgotPass").onClick(resetPass)
    //authentication.onLogin(() => { wixLocation.to("/viewuserrequests"); })
    //authentication.onLogin(() => { wixLocationFrontend.to("/viewuserrequests");})

});

export async function login() {

    $w("#sectionMain").collapse()
    $w("#sectionSpinner").expand();

    let email = $w("#inputEmail").value;
    let password = $w("#inputPass").value;

    wixUsers.login(email, password).then(() => {

            console.log("log success");
            wixLocation.to("/viewuserrequests")

        })
        .catch((err) => {
            console.log(JSON.stringify(err.details));
            $w("#sectionMain").expand()
            $w("#sectionSpinner").collapse();

        });

}

This sounds plausible. Does it happen even if the user is already logged in?