<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of meli_items
 *
 * @author usuario
 */
class Auth_model extends CI_Model {

    function get_autorize() {
        $this->load->library('Mercadolibre');
        session_save_path('/tmp');
        session_start('teste');
        $client_id = '6616692121824905';
        $secret = 'YWBb3bOwYuoqxfS6UIDwrpQQ5vvlDBWW';
        $site_id = 'MLA';

        $meli = new Mercadolibre($client_id, $secret, $site_id, NULL, NULL, NULL);

        $data = $meli->automaticAuth('http://localhost/csvToMeli/index.php/auth/autorize');
        if ($data["access_token"] != NULL) {
            $result = $data;
        } else {
            $result = "Error OAUTH";
        }

        return $result;
    }

}
