PHPackages                             askvortsov/flarum-auth-sync - 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. askvortsov/flarum-auth-sync

ActiveFlarum-extension[Authentication &amp; Authorization](/categories/authentication)

askvortsov/flarum-auth-sync
===========================

Manage Sync from External Identity Providers

v2.0.0(5y ago)1461[11 PRs](https://github.com/askvortsov1/flarum-auth-sync/pulls)MITPHP

Since Feb 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/askvortsov1/flarum-auth-sync)[ Packagist](https://packagist.org/packages/askvortsov/flarum-auth-sync)[ RSS](/packages/askvortsov-flarum-auth-sync/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (1)Versions (27)Used By (0)

Flarum Auth Sync
================

[](#flarum-auth-sync)

[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667) [![Latest Stable Version](https://camo.githubusercontent.com/532482a1ee1a136cf72316fb6ce896798e09335a8061e3a29773e39cf06d141f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61736b766f7274736f762f666c6172756d2d617574682d73796e632e737667)](https://packagist.org/packages/askvortsov/flarum-auth-sync)

A [Flarum](http://flarum.org) extension to sync user attributes when authenticated by an external identity provider. This extension provides support for syncing:

- Avatar
- Groups
- Bio
- Masquerade Attributes

Some authentication protocols, such as SAML2, LDAP, OpenID Connect, etc have the ability to send attributes along with an authentication response. This extension provides a framework for syncing user attributes and permissions via that attribute response.

### Installation

[](#installation)

Use [Bazaar](https://discuss.flarum.org/d/5151-flagrow-bazaar-the-extension-marketplace) or install manually with composer:

```
composer require askvortsov/flarum-auth-sync
```

### Updating

[](#updating)

```
composer update askvortsov/flarum-auth-sync
```

### How to Use

[](#how-to-use)

For flarum administrators, if you're using an authentication extension that uses flarum auth sync, you can use the settings popup on the Flarum Admin extensions page to choose which types of attributes you'd like to sync. Please note that in order to sync Bios and Masquerade Profile Fields, you need to install and enable the [Friends of Flarum User Bios](https://github.com/FriendsOfFlarum/user-bio) and [Friends of Flarum Masquerade](https://github.com/FriendsOfFlarum/masquerade) extensions.

To use this extension in another authentication extension:

- Import the AuthEventSync model via `use Askvortsov\FlarumAuthSync\Models\AuthSyncEvent;`
- Before logging in/registering the user, create an AuthSyncEvent. Ex:

```
use Askvortsov\FlarumAuthSync\Models\AuthSyncEvent;
use use Carbon\Carbon;

...

if ($this->extensions->isEnabled('askvortsov-auth-sync') && $this->settings->get('askvortsov-saml.sync_attributes', '')) {
    $event = new AuthSyncEvent();
    $event->email="example.user@example.com";
    $event->attributes = json_encode([
        "avatar" => "https://example.com/avatar.jpg",
        "bio" => "Hello, this is my bio",
        "groups" => [1, 15, 2],
        "masquerade_attributes" => [
            "First Name" => "Example",
            "Last Name" => "User",
            "Website" => "https://example.com
        ]
    ]);
    $event->time = Carbon::now();
    $event->save();
}

```

- Of course, replace the generic values above with attributes from your Identity Provider's response.
- Attributes should be provided in a json-encoded string (see above example). The JSON string should have the following attributes:
    - `avatar`: A URL pointing to an image for the user's avatar. Make sure that the file type is compatible with Flarum (jpeg or png I believe).
    - `groups`: A comma-separated list of ids for groups that a user should belong to. Keep in mind that this will both add and remove groups, so make sure that all desired groups are included.
    - `bio`: A string that will be synced to the user's bio if [Friends of Flarum User Bios](https://github.com/FriendsOfFlarum/user-bio) is enabled
    - `masquerade_attributes`: An associative array for any masquerade keys and attributes you want to sync. Make sure that the key matches the name of the profile field exactly.

This was originally developed for [Flarum SAML2 SSO](https://github.com/askvortsov1/flarum-saml). For an example of how to integrate it, please see [this line](https://github.com/askvortsov1/flarum-saml/blob/d3837acc54eb432366da067f4bdecf31d0a6ff42/src/Controllers/ACSController.php#L60).

### TODO

[](#todo)

- Add better validation and error handling.
- Add a setting to support default groups that all users should be added to, and groups that users should never be synced to.
- Add an expiry setting for Auth Sync Events.
- Add support for getting users via LoginProvider providers and identifiers, in addition to email.
- Due to a bug in flarum core, the `LoggedIn` event isn't dispatched when logging in via an external identity provider. Until this is fixed, the UserUpdatedListener listens to `Serialize` events (except those going to masquerade). This workaround will be promptly removed when the upstream bug is fixed.

### Feedback

[](#feedback)

Super excited to be posting my first extensions, hopefully more to follow! If you run into issues or have feature requests, let me know and I'll look into it!

### Links

[](#links)

- [Github](https://github.com/askvortsov1/flarum-auth-sync)
- [Flagrow](https://flagrow.io/extensions/askvortsov/flarum-auth-sync)
- [Packagist](https://packagist.org/packages/askvortsov/flarum-auth-sync)
- [Discuss](https://discuss.flarum.org/d/22759-flarum-auth-sync)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 91.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 ~25 days

Recently: every ~57 days

Total

13

Last Release

1978d ago

Major Versions

v0.1.2 → v1.0.02020-02-24

v0.1.3 → v1.0.12020-04-07

v1.1.0 → v2.0.02020-12-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/545a920fc6d01092248f49fb305da628a1bcff5b357a9b162cf0872e2d5ff3c1?d=identicon)[askvortsov](/maintainers/askvortsov)

---

Top Contributors

[![askvortsov1](https://avatars.githubusercontent.com/u/38059171?v=4)](https://github.com/askvortsov1 "askvortsov1 (22 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

flarum

### Embed Badge

![Health badge](/badges/askvortsov-flarum-auth-sync/health.svg)

```
[![Health](https://phpackages.com/badges/askvortsov-flarum-auth-sync/health.svg)](https://phpackages.com/packages/askvortsov-flarum-auth-sync)
```

###  Alternatives

[fof/oauth

Allow users to log in with GitHub, Facebook, Google, Discord, GitLab, LinkedIn, and more!

50118.7k41](/packages/fof-oauth)[fof/doorman

Create invite codes for users to sign up and be assigned to a group

2537.2k2](/packages/fof-doorman)[maicol07/flarum-ext-sso

SSO for Flarum

468.3k](/packages/maicol07-flarum-ext-sso)[fof/terms

Ask users to accept terms of use before using the forum

1367.8k1](/packages/fof-terms)[fof/passport

The OAuth2 (and Laravel passport) compatible oauth extension

3013.3k](/packages/fof-passport)[foskym/flarum-oauth-center

Allow user to authorize the third clients

221.4k](/packages/foskym-flarum-oauth-center)

PHPackages © 2026

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