PHPackages                             mpyw/scoped-auth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. mpyw/scoped-auth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

mpyw/scoped-auth
================

Apply specific scope for user authentication.

v2.1.0(1y ago)1180.5k↓19.6%3MITPHPPHP ^8.2CI passing

Since Dec 10Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/mpyw/scoped-auth)[ Packagist](https://packagist.org/packages/mpyw/scoped-auth)[ RSS](/packages/mpyw-scoped-auth/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (8)Versions (8)Used By (0)

Scoped Auth
===========

[](#scoped-auth)

[![Build Status](https://github.com/mpyw/scoped-auth/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/mpyw/scoped-auth/actions)[![Coverage Status](https://camo.githubusercontent.com/d7639e113c649587eae69dfa72195e75d71045bf6927dffc945b3c63274119f9/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d7079772f73636f7065642d617574682f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/mpyw/scoped-auth?branch=master)

Apply specific scope for user authentication.

Requirements
------------

[](#requirements)

- PHP: `^8.2`
- Laravel: `^11.0 || ^12.0`

Note

Older versions have outdated dependency requirements. If you cannot prepare the latest environment, please refer to past releases.

Installing
----------

[](#installing)

Via [Composer](https://getcomposer.org/)

```
$ composer require mpyw/scoped-auth
```

### For [Fortify](https://github.com/laravel/fortify) users

[](#for-fortify-users)

Note

The issue where `RedirectIfTwoFactorAuthenticatable` bypassed custom `UserProvider` implementations has been fixed in **Fortify v1.33.0** ([PR #582](https://github.com/laravel/fortify/pull/582)). If you're using Fortify v1.33.0 or later, no workaround is needed.

Workaround for older versions (&lt; v1.33.0)Default Fortify's [`RedirectIfTwoFactorAuthenticatable`](https://github.com/laravel/fortify/blob/7da6504f5f8a5fe6854dedaffc81ac497194ba56/src/Actions/RedirectIfTwoFactorAuthenticatable.php#L89-L91) implementation directly uses internal `Model` under `UserProvider`. So we need to configure Fortify like this:

**CustomFortifyAuthenticator.php**

```
