public function isAccessTokenExpired()
  {
    if (!$this->token) {
      return true;
    }

    $created = 0;
    if (isset($this->token['created'])) {
      $created = $this->token['created'];
    } elseif (isset($this->token['id_token'])) {
      // check the ID token for "iat"
      // signature verification is not required here, as we are just
      // using this for convenience to save a round trip request
      // to the Google API server
      $idToken = $this->token['id_token'];
      if (substr_count($idToken, '.') == 2) {
        $parts = explode('.', $idToken);
        $payload = json_decode(base64_decode($parts[1]), true);
        if ($payload && isset($payload['iat'])) {
          $created = $payload['iat'];
        }
      }
    }

    // If the token is set to expire in the next 30 seconds.
    return ($created + ($this->token['expires_in'] - 30)) < time();
  }
public function isAccessTokenExpired()
  {
    if (!$this->token) {
      return true;
    }

    $created = 0;
    if (isset($this->token['created'])) {
      $created = $this->token['created'];
    } elseif (isset($this->token['id_token'])) {
      // check the ID token for "iat"
      // signature verification is not required here, as we are just
      // using this for convenience to save a round trip request
      // to the Google API server
      $idToken = $this->token['id_token'];
      if (substr_count($idToken, '.') == 2) {
        $parts = explode('.', $idToken);
        $payload = json_decode(base64_decode($parts[1]), true);
        if ($payload && isset($payload['iat'])) {
          $created = $payload['iat'];
        }
      }
    }

    // If the token is set to expire in the next 30 seconds.
    return ($created + ($this->token['expires_in'] - 30)) < time();
  }
public function isAccessTokenExpired ( ) { if ( ! $ this -> token ) { return true ; } $ created = 0 ; if ( isset ( $ this -> token [ 'created' ] ) ) { $ created = $ this -> token [ 'created' ] ; } elseif ( isset ( $ this -> token [ 'id_token' ] ) ) { // check the ID token for "iat" // signature verification is not required here, as we are just // using this for convenience to save a round trip request // to the Google API server $ idToken = $ this -> token [ 'id_token' ] ; if ( substr_count ( $ idToken , '.' ) == 2 ) { $ parts = explode ( '.' , $ idToken ) ; $ payload = json_decode ( base64_decode ( $ parts [ 1 ] ) , true ) ; if ( $ payload && isset ( $ payload [ 'iat' ] ) ) { $ created = $ payload [ 'iat' ] ; } } } // If the token is set to expire in the next 30 seconds. return ( $ created + ( $ this -> token [ 'expires_in' ] - 30 ) ) < time ( ) ; }
Returns if the access_token is expired.
@return bool Returns True if the access_token is expired.
Returns if the access_token is expired .