I have created a subdomain context in the manager and have followed all the steps to restrict access to pages but it doesnt seem to work for a subdomain.
I tried the following but I always get Unauthorised when I try to login
$ctx = $modx->context->get('key');
if (!$modx->user->hasSessionContext( array($ctx)));
$modx->sendUnauthorizedPage();