PHPackages                             jmikola/auto-login - 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. jmikola/auto-login

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

jmikola/auto-login
==================

Facilitates automatic login via a single token for Symfony's Security component.

2.0.3(4y ago)100307.6k↓19.2%22[1 PRs](https://github.com/jmikola/AutoLogin/pulls)2MITPHPPHP &gt;=7.1

Since Feb 26Pushed 2y ago6 watchersCompare

[ Source](https://github.com/jmikola/AutoLogin)[ Packagist](https://packagist.org/packages/jmikola/auto-login)[ Docs](https://github.com/jmikola/AutoLogin)[ RSS](/packages/jmikola-auto-login/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (17)Used By (2)

AutoLogin
=========

[](#autologin)

This library implements a Symfony security firewall listener to authenticate users based on a single query parameter. This is useful for providing one-click login functionality in email and newsletter links.

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

[](#installation)

The library is published as a [package](https://packagist.org/packages/jmikola/auto-login) and is installable via [Composer](http://getcomposer.org/):

```
$ composer require jmikola/auto-login

```

### Compatibility

[](#compatibility)

This library requires Symfony 4.3 or above.

Usage
-----

[](#usage)

This library implements authentication provider and firewall listener classes, which may be plugged into Symfony's security component to intercept requests and automatically authenticate users based on a single request parameter.

To utilize this library in a full-stack Symfony application, you may want to use [JmikolaAutoLoginBundle](https://github.com/jmikola/JmikolaAutoLoginBundle). An example of registering an authentication provider and firewall listener manually may be found in the [Security component documentation](http://symfony.com/doc/current/components/security/firewall.html).

### Token

[](#token)

When a user is automatically logged in by a token parameter in the request, they will be authenticated with an `AutoLoginToken` instance. In the context of authorization, this token satisfies `IS_AUTHENTICATED_FULLY`. Ideally, it would be possible to restrict the token to `IS_AUTHENTICATED_REMEMBERED`, but that is not yet supported. Additional information on these authorization levels may be found in Symfony's [authorization documentation](http://symfony.com/doc/current/components/security/authorization.html).

### Events

[](#events)

The firewall listener may dispatch events if constructed with an [event dispatcher](http://symfony.com/doc/current/components/event_dispatcher/introduction.html) instance.

#### Interactive Login

[](#interactive-login)

Upon successful authentication by a token parameter in the request, an interactive login core event will be dispatched with the authenticated `AutoLoginToken` instance.

#### Already Authenticated

[](#already-authenticated)

*This event was contributed by [Antonio Trapani](https://github.com/TwistedLogic) in [PR #9](https://github.com/jmikola/AutoLogin/pull/9).*

If a token parameter is present in the request, but the user is already authenticated, a custom event will be dispatched, which includes the token's value. After dispatching this event, the listener's default behavior is to return immediately, since there is likely no work to be done.

A practical use for this event would be to mark a user's email addresses as confirmed, assuming the auto-login link with the token was only delivered via email. As a business requirement, the confirmation service might also listen to the interactive login core event and operate when the authenticated token was an `AutoLoginToken` instance.

**Note:** Unlike the interactive login event, the token parameter in this event will not have been validated. It will be the responsibility of the listener to check whether it matches the currently authenticated user. For this reason, it may be helpful to inject this library's provider class.

#### Overriding Already Authenticated Users

[](#overriding-already-authenticated-users)

*This feature was contributed by [Mathieu Gauthier-Lafaye](https://github.com/gauthierl) in [PR #10](https://github.com/jmikola/AutoLogin/pull/10).*

By default, the listener will only dispatch an event if the user is already authenticated; it does not override the existing authenticated user. In some cases, it may be desirable to allow an auto-login link to override an existing authenticated user. Otherwise, the user would first need to log out before using the auto-login link. Setting the listener's `override_already_authenticated`boolean option to `true` will enable this behavior.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~217 days

Recently: every ~309 days

Total

15

Last Release

1784d ago

Major Versions

1.2.4 → 2.0.02020-04-02

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.2

2.0.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/49096f4052ca788ddf49c82e835125294f460f155885aa3e1ada8c3ff4f4a648?d=identicon)[jmikola](/maintainers/jmikola)

---

Top Contributors

[![jmikola](https://avatars.githubusercontent.com/u/244663?v=4)](https://github.com/jmikola "jmikola (36 commits)")[![fran6co](https://avatars.githubusercontent.com/u/726088?v=4)](https://github.com/fran6co "fran6co (3 commits)")[![henrikbjorn](https://avatars.githubusercontent.com/u/19725?v=4)](https://github.com/henrikbjorn "henrikbjorn (3 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (2 commits)")[![rasmustnilsson](https://avatars.githubusercontent.com/u/22005479?v=4)](https://github.com/rasmustnilsson "rasmustnilsson (2 commits)")[![espritf](https://avatars.githubusercontent.com/u/153933?v=4)](https://github.com/espritf "espritf (2 commits)")[![TwistedLogic](https://avatars.githubusercontent.com/u/105908?v=4)](https://github.com/TwistedLogic "TwistedLogic (1 commits)")[![lenar](https://avatars.githubusercontent.com/u/281544?v=4)](https://github.com/lenar "lenar (1 commits)")[![Reflex14](https://avatars.githubusercontent.com/u/8163554?v=4)](https://github.com/Reflex14 "Reflex14 (1 commits)")[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (1 commits)")[![SvetlinStaev](https://avatars.githubusercontent.com/u/8427480?v=4)](https://github.com/SvetlinStaev "SvetlinStaev (1 commits)")[![bocharsky-bw](https://avatars.githubusercontent.com/u/3317635?v=4)](https://github.com/bocharsky-bw "bocharsky-bw (1 commits)")

---

Tags

securityAuthenticationloginauto-login

### Embed Badge

![Health badge](/badges/jmikola-auto-login/health.svg)

```
[![Health](https://phpackages.com/badges/jmikola-auto-login/health.svg)](https://phpackages.com/packages/jmikola-auto-login)
```

###  Alternatives

[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k172.9M1.8k](/packages/symfony-security-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[scheb/2fa

Two-factor authentication for Symfony applications (please use scheb/2fa-bundle to install)

578630.7k1](/packages/scheb-2fa)[jmikola/auto-login-bundle

Authenticate users in your Symfony app via a single query parameter (e.g. email and newsletter links).

84323.6k](/packages/jmikola-auto-login-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
