top of page
  • Writer's pictureArun Kumar

Wix Redirect Member After Login/Logout

We must use authentication.onLogin() and authentication.onLogout() functions in masterPage.js file to redirect users on login and on logout.


Add Members Area to Wix Website


You must have Wix Members Area app pre-installed to setup login/logout functionality.



Add Code to masterPage.js


The below code must be written under masterPage.js so that it is loaded on all the pages of your website. If user tries to login/logout from any page, they will be re-directed to respective pages

import {authentication} from 'wix-members';
import wixLocation from 'wix-location';


$w.onReady(function () {
	
	authentication.onLogin(() => {
		wixLocation.to("/dashboard");	//redirect to dashboard
	});

	authentication.onLogout(() => {
		wixLocation.to("/about");		//redirect to home page
	});

});

🚀🚀🚀

16 views0 comments

Recent Posts

See All
bottom of page