Welcome Guest, Not a member yet? Register   Sign In
CI4 and Myth Auth
#1

(This post was last modified: 02-11-2020, 04:27 PM by Mobostar.)

Hello,



I will need an Auth for CI4 and I decided to check out Myth Auth for CI4. So, I installed it via Composer, and did the basic settings following the instructions at https://github.com/lonnieezell/myth-auth.



I have set it to work globally in app/Config/Filters.php:



PHP Code:
public $globals = [
        'before' => [
            'login',
        ],
        'after'  => [
            'toolbar',
        ],
    ]; 


So, when a user browses any page on the website he/she should be redirected to login page if not logged in already.



However, strange things happen when I browse the website. First, the URL ends up with "/index.php/login" despite having URL rewriting enabled and working fine until I started to experiment with Myth Auth. Plus, I get a 404 page.



If I directly type "/login" into the address bar to get rid of the "index.php", I still get a 404.



If I remove "login" from $globals, basically bypassing Myth Auth, things go back to normal and URL rewriting starts to work as expected. I am able to browse website's other pages. But, Myth Auth's login is still a 404.



The login view file of Myth Auth is where it is supposed to be. I could not figure out so far why 1- "index.php" is being inserted into the URL and 2- why the 404 page.



Does anyone using Myth Auth with CI4 have any idea ?



Thanks




SOLVED



I found the reason. Another routing rule in CI4's Routes.php was getting in the way.



/Cheers  Big Grin

FOLLOW UP:

Well, that actually solved only part of the issue. I do not get 404s anymore but the "index.php" is still being inserted into the URI.
Reply


Messages In This Thread
CI4 and Myth Auth - by Mobostar - 02-11-2020, 03:41 PM
RE: CI4 and Myth Auth - by MGatner - 02-16-2020, 12:56 PM
RE: CI4 and Myth Auth - by Mobostar - 02-17-2020, 05:16 PM
RE: CI4 and Myth Auth - by MGatner - 02-18-2020, 04:40 AM
RE: CI4 and Myth Auth - by InsiteFX - 02-18-2020, 05:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB