Welcome Guest, Not a member yet? Register   Sign In
Myth Auth LoginFilter Problem
#11

I just checked the Myth/Auth and he is adding the filter to separate routes not group route.

So maybe it will not work on group route.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#12

(This post was last modified: 01-04-2021, 05:53 PM by PwrSrg.)

(09-14-2020, 04:46 AM)ralphcabanero Wrote: Yes i did it already, and it is now working. Though i have a new issue on it. Whenever i logged with my username and password, the auth is not working, i have checked the database auth_login table and it was successfully logged in but upon checking on the CI dev toolbar the Auth says ¨Not logged in¨ and i cannot push through to the index page.

YES, please share with the world how you fixed this issue, as I am ALSO having the same exact issue and error.

Here are just three of the approaches I have tried, and NONE of these work:
Code:
$routes->group('', ['filter' => 'login'], function($routes) {
    $routes->get('/dashboard', 'Games::dashboard');
});

Code:
$routes->get('/dashboard', 'Games::dashboard', ['filter' => 'login']);

Code:
$routes->get('/dashboard', 'Games::dashboard', ['filter' => 'role:user']);

My Filters.php file has all of the required $aliases, and I have defined the 'user' role in the auth_groups_users table, as well as have 'user' set as the $defaultUserGroup.


I have confirmed that this works, but this is NOT the way this should be done:
Code:
// My Dashboard
public function dashboard() {
    if (!logged_in()) {
        return redirect()->to('/login');
    }
    return view('games/dashboard');
}


Any help would be appreciated.

Thanks!

Attached Files Thumbnail(s)
   

Bridging the gap between Technical and Creative

VASCOsoft Web Studio   |   AllMyLinks

Reply
#13

@PwrSrg it seems you are using the beta version of myth/auth. You must use the latest develop version. Since you are using composer, you can change your composer.json entry on myth/auth to look like:
Code:
"myth/auth": "dev-develop"
. If your composer.json doesn't have a repositories section, you can add as follows:
Code:
"repositories": [
    {
        "type": "vcs",
        "url: "https://github.com/lonnieezell/myth-auth"
    }
]

Then, just run composer update
Reply
#14

(This post was last modified: 01-06-2021, 06:12 AM by PwrSrg.)

(01-05-2021, 11:43 PM)paulbalandan Wrote: @PwrSrg it seems you are using the beta version of myth/auth. You must use the latest develop version. Since you are using composer, you can change your composer.json entry on myth/auth to look like:
Code:
"myth/auth": "dev-develop"
. If your composer.json doesn't have a repositories section, you can add as follows:
Code:
"repositories": [
    {
        "type": "vcs",
        "url: "https://github.com/lonnieezell/myth-auth"
    }
]

Then, just run composer update

YES, that was it!  Wow, the greatest, most simple answer ever.  ?

I really wish developers would put this stuff in the README.

Thank you!

Bridging the gap between Technical and Creative

VASCOsoft Web Studio   |   AllMyLinks

Reply
#15

I am getting the same 'ErrorException #64'
Codeigniter version 4.1.1 (fresh install)
PHP 7.4.12
Myth/Auth 1.0-beta.3
I have the filter aliases.
I am just trying the simplest implementation: added 'login' to the before globals.

How did you resolve this?
Reply
#16

(This post was last modified: 03-14-2021, 09:15 AM by motownphilippe.)

@paulbalandan I have edited the composer.json entry in the root of my site and then tried to update Myth/Auth.

It asked for GitHub token which I gave it then I get this error:

Code:
Install of myth/auth failed

                                                                                     
  [RuntimeException]                                                                 
  Failed to clone https://github.com/lonnieezell/myth-auth.git, git was not found,   
  check that it is installed and in your PATH env.                                   
                                                                                     
  xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) 
  , missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

I have confirmed that Xcode CLI tools are installed.

Please help. what am I doing wrong?
Reply
#17

(This post was last modified: 01-27-2024, 05:29 AM by Newbie_Mark998.)

i have applied this filter to restrict access to a certain url  in config/routes.php

PHP Code:
$routes->get('user/profile''User::profile', ['filter' => 'role:User']); 

[Image: HKC3ckd]
when i log in as another role user for example admin and i try to access the page  /user/profile   i get the above error

Myth\Auth\Exceptions\PermissionException
You do not have sufficient permissions to access that page.

however I want to redirect them to the main url

i could achieve it using $this->restrictToGroups('User','dashboard' ); but still dont know how to do using filters
Reply




Theme © iAndrew 2016 - Forum software by © MyBB