CodeIgniter Forums
Ion_auth CI4 - Configuration problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Ion_auth CI4 - Configuration problem (/showthread.php?tid=75947)



Ion_auth CI4 - Configuration problem - Marcolino92 - 03-31-2020

I have implemented through archive all the files necessary for the installation of Ion Auth for CI4, but unfortunately I am shown a 404 error:

404 - File Not Found

Controller or its method is not found: \IonAuth\Controllers\Auth::login


I entered the correct routes, but nothing.
How can I correct it?


RE: Ion_auth CI4 - Configuration problem - Marcolino92 - 04-01-2020

I managed to adapt it and make it work, I have to do some practice. Once logged in, I set it to be redirected to the index of another controller (not auth) but displays this error:

Call to a member function loggedIn() on null

PHP Code:
if (!$this->ionAuth->loggedIn())
{
    echo 'Non sei collegato';




RE: Ion_auth CI4 - Configuration problem - kabeza - 05-16-2020

Edit:

Solved it by removing all ionauth files.
Then I installed ionauth with composer
https://github.com/benedmunds/CodeIgniter-Ion-Auth/tree/4


Code:
    class Client extends BaseController
{
    protected $ionAuth;
    
    public function __construct()
    {
        $this->ionAuth = new \IonAuth\Libraries\IonAuth();
    }

    public function index()
    {
        if(!$this->ionAuth->loggedIn()){
            // note the auth without / at beg. nor end that's the route defined later
            return redirect('auth/login');
        }
        else {
                echo "Logged in user";
        }
    }
}

My Routes

Code:
$routes->group('auth', ['namespace' => 'IonAuth\Controllers'], function ($routes) {
    $routes->add('login', 'Auth::login');
    $routes->get('logout', 'Auth::logout');
    $routes->add('forgot_password', 'Auth::forgot_password');
});

Now I have to work with the IonAuth views