PHPackages                             assegaiphp/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. [Framework](/categories/framework)
4. /
5. assegaiphp/auth

ActiveLibrary[Framework](/categories/framework)

assegaiphp/auth
===============

Authentication strategies for AssegaiPHP and standalone PHP applications.

0.9.0(3mo ago)021MITPHPPHP &gt;=8.4CI passing

Since Feb 2Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/assegaiphp/auth)[ Packagist](https://packagist.org/packages/assegaiphp/auth)[ RSS](/packages/assegaiphp-auth/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (12)Versions (14)Used By (0)

 [ ![Assegai Logo](https://camo.githubusercontent.com/d7dab2658d76e460e31be249de2fe5d420f7a7237eb9f2a315f83123632a3b6c/68747470733a2f2f617373656761697068702e636f6d2f696d616765732f6c6f676f732f6c6f676f2d63726f707065642e706e67) ](https://assegaiphp.com/)

 [![Latest release](https://camo.githubusercontent.com/4f40942ebe3f2ca771553b20e018e5ab44be821e73ab81a3bd838724c8240ea4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f617373656761697068702f617574683f646973706c61795f6e616d653d74616726736f72743d73656d766572267374796c653d666c61742d737175617265)](https://github.com/assegaiphp/auth/releases) [![Tests](https://camo.githubusercontent.com/b2c996f58aed3c5043f65cc0997b527ee54b4173a38911628430c7d346d28e80/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f617373656761697068702f617574682f7068702e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/assegaiphp/auth/actions/workflows/php.yml) [![PHP 8.4+](https://camo.githubusercontent.com/51482859d8bb7cd31d259f58cf02b8eb7e56c51ad36c462afa3484f3b7a8fc2c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342532422d3737374242343f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/51482859d8bb7cd31d259f58cf02b8eb7e56c51ad36c462afa3484f3b7a8fc2c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342532422d3737374242343f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465) [![License](https://camo.githubusercontent.com/9771565bda1bff78b658e84f248900afcc8e2310cd662f8eae5ad9092a0b5d64/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f617373656761697068702f617574683f7374796c653d666c61742d737175617265)](https://github.com/assegaiphp/auth/blob/main/LICENSE) [![Status active](https://camo.githubusercontent.com/1214b36790042a591c22d285a8cbfdc3c33d1cbbbed099a0bca2f5edd79ca2a0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d6163746976652d3130623938313f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/1214b36790042a591c22d285a8cbfdc3c33d1cbbbed099a0bca2f5edd79ca2a0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d6163746976652d3130623938313f7374796c653d666c61742d737175617265)

 Authentication strategies for AssegaiPHP and standalone PHP applications.

Overview
--------

[](#overview)

`assegaiphp/auth` is a small authentication package built around focused strategies instead of a full auth framework.

Today the package ships with:

- `SessionAuthStrategy` for session-backed login state
- `JwtAuthStrategy` for stateless JWT authentication
- `OAuth2AuthStrategy` for OAuth 2.0 authorization-code login flows
- `GitHubOAuthProvider` as the first ready-to-use OAuth provider adapter

The package is intentionally narrow. It helps you:

- authenticate a known user object
- issue session or JWT auth state
- begin and complete OAuth 2.0 login flows
- hand a resolved OAuth user into session or JWT auth

It does not currently provide:

- user lookup or persistence
- registration or password reset flows
- refresh token rotation
- OAuth route/controllers for you
- OAuth guard wiring
- multiple polished provider adapters beyond GitHub

You still own the application flow around it: loading users, choosing when to authenticate, defining routes, and deciding what to do after login succeeds.

Contribution workflow
---------------------

[](#contribution-workflow)

For commit and pull request conventions in this repo, see:

- [docs/commit-and-pr-guidelines.md](./docs/commit-and-pr-guidelines.md)

Installation
------------

[](#installation)

```
composer require assegaiphp/auth
```

Session Authentication
----------------------

[](#session-authentication)

Use `SessionAuthStrategy` when you want the authenticated user stored in `$_SESSION`.

```
