Is there a way to restrict access to site via code or plugin to only logged in users with Auth0?
Hello @anhtuandinh,
Welcome to the Community!
You can allow / deny access using a Rule. For example:
function (user, context, callback) {
var groupAllowed = 'group1';
if (user.groups) {
var userHasAccess = user.groups.some(
function (group) {
return groupAllowed === group;
});
if (!userHasAccess) {
return callback(new UnauthorizedError('Access denied.'));
}
}
callback(null, user, context);
}
I figured it out with use of Force Login wordpress plugin
Glad you have it working and thanks for sharing the solution with the rest of community!