Как избежать переопределения Podio каждый раз, когда я запрашиваю данные из Podio?

Я пишу контроллер codeigniter. Пользователи регистрируются на веб-сайте как пользователи Podio. После входа в систему они перенаправляются на панель управления.

Функция test_auth делает аутентификацию и перенаправляет пользователей на панель мониторинга.

Проблема заключается в следующем: в функции панели инструментов мне нужно повторно указать, если я хочу позвонить, например, function PodioOrganization::get_all( );

Вот мой код:

 class User extends CI_Controller { /** * __construct function. * * @access public * @return void */ public function __construct() { parent::__construct(); $this->load->library(array('session')); $this->load->helper(array('url')); $this->load->model('user_model'); } public function dashboard() { if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] != true) {//not logged redirect(base_url().'user/login'); }else { $data=(array)$this->user_model->get_user($_SESSION['user_id']); //$data=(array)$this->user_model->get_user(3); $data['title'] ='Dashboard Page'; //'heading' => 'My Heading', //'message' => 'My Message' Podio::setup(CLIENT_ID, CLIENT_SECRET); $orgs=PodioOrganization::get_all( ); $this->load->view('header',$data); $this->load->view('user/page_header',$data); $this->load->view('user/dashboard',$data); $this->load->view('user/footer'); } } public function test_auth() { // Set up the REDIRECT_URI -- which is just the URL for this file. if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] === true ) { redirect(base_url().'user/dashboard'); } else{ Podio::setup(CLIENT_ID, CLIENT_SECRET); if (!isset($_GET['code']) && !Podio::is_authenticated()) { // User is not being reidrected and does not have an active session // We just display a link to the authentication page on podio.com $auth_url = htmlentities(Podio::authorize_url(REDIRECT_URI)); //print "<a href='{$auth_url}'>Start authenticating</a>"; redirect($auth_url); } elseif (Podio::is_authenticated()) { // User already has an active session. You can make API calls here: print "You were already authenticated and no authentication is needed."; } elseif (isset($_GET['code'])) { // User is being redirected back from podio.com after authenticating. // The authorization code is available in $_GET['code'] // We use it to finalize the authentication // If there was a problem $_GET['error'] is set: if (isset($_GET['error'])) { print "There was a problem. The server said: {$_GET['error_description']}"; } else { // Finalize authentication. Note that we must pass the REDIRECT_URI again. Podio::authenticate_with_authorization_code($_GET['code'], REDIRECT_URI); $_SESSION['user_id'] = 1; $_SESSION['logged_in'] = (bool)true; $_SESSION['access_token'] = (string)Podio::$oauth->access_token ; $_SESSION['refresh_token']= (string)Podio::$oauth->refresh_token ; redirect(base_url().'user/dashboard'); } } } } 

И я получаю PodioAuthorizationError, для вызова $orgs=PodioOrganization::get_all( ); без аутентификации сначала (хотя я сделал это, ранее, в функции test_auth)

И как только я позвонил Podio::setup(CLIENT_ID, CLIENT_SECRET); в test_auth (), почему я должен снова называть его на панели управления (). Необходимо установить функцию $client_id и $client_secret insite setup (). Почему Podio::setup теряет свои значения?

$client_id и $client_secret объявляются статическими внутри класса Podio, поэтому они должны сохранять свои значения, но они этого не делают. Зачем?

Solutions Collecting From Web of "Как избежать переопределения Podio каждый раз, когда я запрашиваю данные из Podio?"