Welcome Guest, Not a member yet? Register   Sign In
Sparks OAuth2 - Undefined Property
#1

[eluser]ZaLiTHkA[/eluser]
I'm trying CodeIgniter Sparks for the first time, specifically for the OAuth2 spark, but no matter what I do I can't get past this error:

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI::$oauth2

Filename: MX/Controller.php

Line Number: 58

I followed the instructions here to set up Sparks, which all went through without any problems.. I've got OAuth2 0.4.0 listed in the autoload.php file for my app, and my Auth controller contains the following:

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Auth extends Admin_Controller {
public function session($provider) {
  $provider = $this->oauth2->provider($provider, array(
   'id' => 'secret',
   'secret' => 'secret',
  ));
  
  if (!$this->input->get('code')) {
   // By sending no options it'll come back here
   $provider->authorize();
  } else {
   // Howzit?
   try {
    $token = $provider->access($_GET['code']);
    $user = $provider->get_user_info($token);
    
    // Here you should use this information to A) look for a user B) help a new user sign up with existing data.
    // If you store it all in a cookie and redirect to a registration page this is crazy-simple.
    echo "<pre>Tokens: ";
    var_dump($token);
    
    echo "\n\nUser Info: ";
    var_dump($user);
   }
  
   catch (OAuth2_Exception $e) {
    show_error('That didnt work: '.$e);
   }
  }
}
}

I'm very confused as to where it's going wrong.. Any bright ideas?




Theme © iAndrew 2016 - Forum software by © MyBB