diff --git a/simplesamlphp_auth.module b/simplesamlphp_auth.module
index b3f3ed1..875e610 100644
--- a/simplesamlphp_auth.module
+++ b/simplesamlphp_auth.module
@@ -88,6 +88,7 @@ function simplesamlphp_auth_permission() {
  * Represents the Drupal page (saml_login), which triggers user authentication against the SimpleSAMLphp service provider.
  */
 function simplesamlphp_auth_loginpage() {
+  _simplesamlphp_auth_init();
   global $user;
   global $base_url;
   global $_simplesamlphp_auth_as;
@@ -188,9 +189,9 @@ function simplesamlphp_auth_loginpage() {
 }
 
 /**
- * Implements hook_init().
+ * Similar purpose to hook_init() only must be manually invoked.
  */
-function simplesamlphp_auth_init() {
+function _simplesamlphp_auth_init() {
   global $user;
   global $_simplesamlphp_auth_as;
   global $_simplesamlphp_auth_saml_attributes;
@@ -407,6 +408,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;
@@ -621,6 +623,7 @@ function simplesamlphp_auth_form_alter(&$form, $form_state, $form_id) {
  * Implements hook_block_view().
  */
 function simplesamlphp_auth_block_view($delta = '') {
+  _simplesamlphp_auth_init();
 
   if (!_simplesamlphp_auth_isEnabled()) {
     // Exit without executing.
