![]() |
Myth / auth problems
I have a manual installation of Codeigniter 4.1.5 on xampp8, php version 8.0.12. I also installed myth / auth manually on the folder C: \ xampp8 \ htdocs \ codeigniter4 \ app \ ThirdParty \ myth-auth \ If I call http:// 127.0.0.1/codeigniter4/public/index.php/register# It works When I click Sign In it redirects me to 127.0.0.1 \ login I know the matter works via route_to, the documentation says I have to route_to take into account domain_name ??? My base_url is public $ baseURL = public $ baseURL = 'http://127.0.0.1/codeigniter4/public/'; When click on register form (Sign In) login CodeIgniter render to 127.0.0.1\login Debug say Router \ RouteCollection Object report Array ([login] => Array [[route] => Array ([login] => \ Myth \ Auth \ Controllers \ AuthController :: login) Where I have an error in the definitions. (Route I have settings in the routes $ routes-> group ('', '' namespace '=>' Myth \ Auth \ Controllers'], function ($ routes) { // Login / out $ routes-> get ('login', 'AuthController :: login', ['as' => 'login']); $ routes-> post ('login', 'AuthController :: attemptLogin'); $ routes-> get ('logout', 'AuthController :: logout'); // Registration $ routes-> get ('register', 'AuthController :: register', ['as' => 'register']); $ routes-> post ('register', 'AuthController :: attemptRegister'); I read the instructions but I can't find the cause Where is the mistake Thanks. Mateo
One of the reasons I think you are facing this problem is because you are using the manual method. Trust me, composer (and command line) rocks (when you get a good grip of it).
That being said, just as you have rightly pointed out, from the documentation: Code: Generates a URI relative to the domain name [b](not baseUrl)[/b] for you based on either a named route alias, or a controller::method combination. Will take parameters into effect, if provided. For this, you might need to hardcode the urls in the view files (login, register, reset and forgot) of the myth/auth library. You can find them in the myth/auth/src/Views folder. Code: $ baseURL = 'http://127.0.0.1/codeigniter4/public/'; wrong setup. check server config. did you use apache? need setup virtual host (if apache)
Hi.
Now i installed ci4 and myth / auth with composer CI4 is working ( on xampp system apache and php 8) , when I install Myth/auth as instructed Installation is best done via Composer. Assuming Composer is installed globally, you may use the following command: Code: > composer require myth/auth Using version ^1.0 for myth/auth ./composer.json has been updated Running composer update myth/auth Loading composer repositories with package information Updating dependencies Lock file operations: 1 install, 0 updates, 0 removals - Locking myth/auth (v1.0.1) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 1 install, 0 updates, 0 removals - Installing myth/auth (v1.0.1): Extracting archive Generating autoload files 29 packages you are using are looking for funding. Use the `composer fund` command to find out more! composer install myth/auth on folder vendor not on ThirdParty? C:\xampp8\htdocs\ci4\appstarter\vendor\myth Composer also not update any like describe in Manual Installation eg, Should you choose not to use Composer to install, you can clone or download this repo and then enable it by editing app/Config/Autoload.php and adding the Myth\Auth namespace to the $psr4 array. For example, if you copied it into app/ThirdParty: where I make a mistake ? Matteo now it works for me when i have edited the settings in app.php public $baseURL = 'http://127.0.0.1/ci4/appstarter/public/'; and in login form change route_to('register') to base_url(route_to('register')) <p><a href="<?= base_url(route_to('register')) ?>"><?=lang('Auth.needAnAccount')?></a></p> and start wih url http://127.0.0.1/ci4/appstarter/public/login when redirect in register its working http://127.0.0.1/ci4/appstarter/public/register Regards Matteo |
Welcome Guest, Not a member yet? Register Sign In |