title: Podio API - Session Management class error in accessing tokens in Redis
body: <p>I'm trying to use <a href="http://podio.github.io/podio-php/sessions/" rel="nofollow noreferrer">Session Management</a> for API calls, so I don't trigger Auth class function everytime my script run. I mostly used App ID authentication so I used the sample provided for Redis.</p>
  
  <p>However, I'm getting an error <code>"Fatal error: Uncaught Error: Cannot access self:: when no class scope is active in /var/www/html/authcheck.php:22 Stack trace: #0 {main} thrown in /var/www/html/authcheck.php on line 22"</code></p>
  
  <p>The code in line 22 is this - <code>Podio::$oauth = self::$session_manager-&gt;get(Podio::$auth_type);</code></p>
  
  <p>Here's the PHP Script for Session manager class:</p>
  
  <p>Filename: SessionManager.php</p>
  
  <pre><code>&lt;?php 
  require ('podio/podio_lib/PodioAPI.php');
  require ('predis/autoload.php');
  
  class PodioRedisSession {
  
    /**
     * Create a pointer to Redis when constructing a new object
     */
    public function __construct() {
      $this-&gt;redis = new Predis\Client();
    }
  
    /**
     * Get oauth object from session, if present. We use $auth_type as
     * basis for the cache key.
     */
    public function get($auth_type = null) {
  
      // If no $auth_type is set, just return empty
      // since we won't be able to find anything.
      if (!$auth_type) {
        return new PodioOauth();
      }
  
      $cache_key = "podio_cache_".$auth_type['type']."_".$auth_type['identifier'];
  
      // Check if we have a stored session
      if ($this-&gt;redis-&gt;exists($cache_key)) {
  
        // We have a session, create new PodioOauth object and return it
        $cached_value = $this-&gt;redis-&gt;hgetall($cache_key);
        return new PodioOAuth(
          $cached_value['access_token'],
          $cached_value['refresh_token'],
          $cached_value['expires_in'],
          array("type"=&gt;$cached_value['ref_type'], "id"=&gt;$cached_value['ref_id'])
        );
      }
  
      // Else return an empty object
      return new PodioOAuth();
    }
  
    /**
     * Store the oauth object in the session. We ignore $auth_type since
     * it doesn't work with server-side authentication.
     */
    public function set($oauth, $auth_type = null) {
      $cache_key = "podio_cache_".$auth_type['type']."_".$auth_type['identifier'];
  
      // Save all properties of the oauth object in redis
      $this-&gt;redis-&gt;hmset = array(
        'access_token' =&gt; $oauth-&gt;access_token,
        'refresh_token' =&gt; $oauth-&gt;refresh_token,
        'expires_in' =&gt; $oauth-&gt;expires_in,
        'ref_type' =&gt; $oauth-&gt;ref["type"],
        'ref_id' =&gt; $oauth-&gt;ref["id"],
      );
  
    }
  }
  
  ?&gt;
  </code></pre>
  
  <p>Filename: authcheck.php</p>
  
  <pre><code>&lt;?php
  
      require ('podio/podio_lib/PodioAPI.php');
      include ('SessionManager.php');
      $client_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
      $client_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx";
      $app_id = "xxxxxxxxxxx";
      $app_token = "xxxxxxxxxxxxxxxxxxx";
  
  
  
      Podio::setup($client_id, $client_secret, array(
        "session_manager" =&gt; "PodioRedisSession"
      ));
  
      // podio-php will attempt to find a session automatically, but will fail 
      because
      // it doesn't know which $auth_type to use.
      // So we must attempt to locate a session manually.
      Podio::$auth_type = array(
        "type" =&gt; "app",
        "identifier" =&gt; $app_id
      );
      Podio::$oauth = self::$session_manager-&gt;get(Podio::$auth_type);
  
      // Now we can check if anything could be found in the cache and
      // authenticate if it couldn't
      if (!Podio::is_authenticated()) {
        // No authentication found in session manager.
        // You must re-authenticate here.
  
        Podio::authenticate_with_app($app_id, $app_token);
      } else {
  
      //echo "&lt;pre&gt;".print_r($_SESSION, true)."&lt;/pre&gt;";   
      echo "You already authenticated!";  
  
      }
  
      // // We can safely switch to another app now
      // // First attempt to get authentication from cache
      // // If that fails re-authenticate
      // Podio::$auth_type = array(
        // "type" =&gt; "app",
        // "identifier" =&gt; $another_app_id
      // );
      // Podio::$oauth = self::$session_manager-&gt;get(Podio::$auth_type);
  
      // if (!Podio::is_authenticated()) {
        // // No authentication found in session manager.
        // // You must re-authenticate here.
  
        // Podio::authenticate_with_app($another_app_id, $another_app_token);
      // }
      ?&gt;
  </code></pre>