diff --git a/simplesamlphp_auth.inc b/simplesamlphp_auth.inc
index 9a27796..df19632 100644
--- a/simplesamlphp_auth.inc
+++ b/simplesamlphp_auth.inc
@@ -342,6 +342,7 @@ function simplesamlphp_auth_get_attributes($attribute = NULL) {
  *   TRUE if the current user is authenticated through SAML.  FALSE otherwise.
  */
 function simplesamlphp_auth_is_authenticated() {
+  _simplesamlphp_auth_init();
   global $_simplesamlphp_auth_as;
 
   // Assume that the user isn't authenticated until proven otherwise.
diff --git a/simplesamlphp_auth.module b/simplesamlphp_auth.module
index 1f1af92..d06ebea 100644
--- a/simplesamlphp_auth.module
+++ b/simplesamlphp_auth.module
@@ -144,11 +144,19 @@ function _simplesaml_auth_autoload() {
 }
 
 /**
- * Implements hook_init().
+ * Similar purpose to hook_init() only must be manually invoked.
  *
  * If the user has logged out via SAML, log out the user in Drupal as well.
  */
-function simplesamlphp_auth_init() {
+function _simplesamlphp_auth_init() {
+
+  // Ensure this function only executes once per page load.
+  static $gate = FALSE;
+  if ($gate) {
+    return;
+  }
+  $gate = TRUE;
+
   if (user_is_anonymous()) {
     return FALSE;
   }
@@ -186,6 +194,7 @@ function simplesamlphp_auth_init() {
  * Implements hook_user_insert().
  */
 function simplesamlphp_auth_user_insert(&$edit, $account, $category = NULL) {
+  _simplesamlphp_auth_init();
   global $_simplesamlphp_auth_as;
   global $_simplesamlphp_auth_saml_attributes;
 
@@ -230,6 +239,7 @@ function simplesamlphp_auth_user_insert(&$edit, $account, $category = NULL) {
  * Implements hook_user_logout().
  */
 function simplesamlphp_auth_user_logout($account) {
+  _simplesamlphp_auth_init();
   global $user;
   global $_simplesamlphp_auth_as;
   global $_simplesamlphp_auth_saml_attributes;
@@ -350,6 +360,7 @@ function simplesaml_auth_user_profile_form_submit(&$form, $form_state) {
  * Implements hook_block_view().
  */
 function simplesamlphp_auth_block_view($delta = '') {
+  _simplesamlphp_auth_init();
   if (!_simplesaml_auth_autoload()) {
     // Exit without executing.
     return;
diff --git a/simplesamlphp_auth.pages.inc b/simplesamlphp_auth.pages.inc
index 1192529..60e15ea 100644
--- a/simplesamlphp_auth.pages.inc
+++ b/simplesamlphp_auth.pages.inc
@@ -12,6 +12,7 @@
  * against the SimpleSAMLphp service provider.
  */
 function simplesamlphp_auth_loginpage() {
+  _simplesamlphp_auth_init();
 
   // Get the simplesamlphp session.
   $loaded = _simplesaml_auth_autoload();
