PHPackages                             holadev/oauth2-loginradius - 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. holadev/oauth2-loginradius

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

holadev/oauth2-loginradius
==========================

LoginRadius OAuth 2.0 Client Provider for The knpuniversity/oauth2-client-bundle

v2.1.0(1y ago)0694MITPHP

Since Nov 27Pushed 1y ago4 watchersCompare

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

READMEChangelog (1)Dependencies (5)Versions (12)Used By (0)

LoginRadius Provider for OAuth 2.0 Client
=========================================

[](#loginradius-provider-for-oauth-20-client)

[![Latest Version](https://camo.githubusercontent.com/87bd702da55e2b6f64af77eaa6016f204026242ed965bf337d989427745c45c9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f646576656c6f7065722d686f6c612f6f61757468322d6c6f67696e7261646975732e7376673f7374796c653d666c61742d737175617265)](https://github.com/developer-hola/oauth2-loginradius/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/e361ffb65f5270721769fbb1919a7cf1ac7facad8021cc46c0e7ba7ce3115e3a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f646576656c6f7065722d686f6c612f6f61757468322d6c6f67696e7261646975732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/developer-hola/oauth2-loginradius)[![Coverage Status](https://camo.githubusercontent.com/52df2f8d7dfe2552507f23574c43f0e1658ca9abb18ba3d0c3a40e90e26ca235/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f646576656c6f7065722d686f6c612f6f61757468322d6c6f67696e7261646975732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/developer-hola/oauth2-loginradius/code-structure)[![Quality Score](https://camo.githubusercontent.com/d87385fcab1279f624af7b40cca82f3efab4fa0815dd2d641b3339447dc952b6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f646576656c6f7065722d686f6c612f6f61757468322d6c6f67696e7261646975732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/developer-hola/oauth2-loginradius)[![Total Downloads](https://camo.githubusercontent.com/952a506a7cca9fec091f4126c5e8e2c0fea16291b60942ec05f0371e01f6fcf6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646576656c6f7065722d686f6c612f6f61757468322d6c6f67696e7261646975732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/developer-hola/oauth2-loginradius)

This package provides LoginRadius OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

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

[](#installation)

To install, use composer:

```
composer require developer-hola/oauth2-loginradius

```

Usage
-----

[](#usage)

Activate the bundle in the bundles.php file

```
Hola\OAuth2\HolaOAuth2LoginRadiusBundle::class => ['all' => true]

```

Create a knpu\_oauth2\_client.yaml file inside config/packages directory like this:

```
# config/packages/knpu_oauth2_client.yaml
knpu_oauth2_client:
    clients:
        # will create service: "knpu.oauth2.client.foo_bar_oauth"
        # an instance of: KnpU\OAuth2ClientBundle\Client\OAuth2Client
        loginradius_oauth:
            type: generic
            provider_class: Hola\OAuth2\Client\Provider\LoginRadiusProvider

            # optional: a class that extends OAuth2Client
            #client_class: Hola\OAuth2\Client\LoginRadiusClient

            # optional: if your provider has custom constructor options
            # provider_options: {}

            # now, all the normal options!
            client_id: '%env(LOGINRADIUS_API_KEY)%'
            client_secret: '%env(LOGINRADIUS_API_SECRET)%'
            redirect_route: connect_loginradius_check
            redirect_params: {}
```

Define your firewall in the config/packages/security.yaml file:

```
security:
    ...
    firewalls:
        main:
            provider: users  #your custom provider
            anonymous: ~
            logout:
                path:   /logout
                target: /

                handlers: [hola.oauth2.loginradius.logout.handler]
            guard:
                authenticators:
                    - hola.oauth2.loginradius.authenticator
                entry_point: hola.oauth2.loginradius.authenticator

```

Add this interfaces to your User entity:

```
class User implements UserInterface, \Serializable , OauthUserInterface
```

Your user provider must implement the interface UseLoaderInterface, like this:

```
class UserRepository extends ServiceEntityRepository implements UserLoaderInterface
{
    public function loadUserByUsername($username)
    {
        return $this->findOneBy(['email' => $username]);

    }
}
```

The OauthUserInterface allows the system to save the AccessToken of the user to check the this token is valid in each request.

Create a controller with to routes: **connect\_loginradius\_start** and **connect\_loginradius\_check** :

```
class LoginRadiusController extends Controller
{
    /**
     * Link to this controller to start the "connect" process
     *
     * @Route("/connect/loginradius", name="connect_loginradius_start")
     */
    public function connectAction(ClientRegistry $clientRegistry, Request $request)
    {
        return $clientRegistry
            ->getClient('loginradius_oauth') // key used in config/packages/knpu_oauth2_client.yaml
            ->redirect([
	    	'profile','&action=login&regSource=cabecera&new=1' // the scopes you want to access
            ])
        ;
	}

    /**
     * @Route("/connect/loginradius/check", name="connect_loginradius_check")
     */
    public function connectCheckAction(Request $request, ClientRegistry $clientRegistry)
    {

        $client = $clientRegistry->getClient('loginradius_oauth');
        try {
            $user = $client->fetchUser();

            $accessToken = $client->getAccessToken();
            //Login the user saving the accesstoken and redirect to the original url

            //$this->userService->userLogin($user,$accessToken, $request);

            return new RedirectResponse(
                '/myoriginalurl',
                // might be the site, where users choose their oauth provider
                Response::HTTP_TEMPORARY_REDIRECT
            );

            // ...
        } catch (IdentityProviderException $e) {
            // something went wrong!
            // probably you should return the reason to the user
            var_dump($e->getMessage()); die;
        }

    }
}
```

LoginRadius AccessToken check
-----------------------------

[](#loginradius-accesstoken-check)

If you use Oauth2 in various systems, you don't want if you logout of one system your session in the others continues.

To solve this problem we implement an AuthenticationVoter that takes your session accessToken and validates. If the token is invalid you need to login again.

To activate this voter put in the config/packages/security.yaml

```
security:
    access_denied_url: connect_loginradius_start
    access_decision_manager:
         strategy: unanimous
         allow_if_all_abstain: false
```

LoginRadius Session Logout
--------------------------

[](#loginradius-session-logout)

When you logout on your system we need to invalidate the LoginRadius accesstoken, for this reason you'll need to define our LogoutHandler under your firewall in the security.yaml file. If you don't define it, you will not logout from LoginRadius.

```
security:
    firewalls:
        main:
            provider: users
            logout:
                path:   /logout
                target: /

                handlers: [hola.oauth2.loginradius.logout.handler]
            guard:
                authenticators:
                    - hola.oauth2.loginradius.authenticator
                entry_point: hola.oauth2.loginradius.authenticator
```

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/thephpleague/oauth2-github/blob/master/CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/thephpleague/oauth2-github/blob/master/LICENSE) for more information.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% 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 ~200 days

Recently: every ~415 days

Total

10

Last Release

548d ago

Major Versions

1.1.1 → v2.0.02020-05-05

1.1.2 → v2.1.02024-11-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/983f128eeb1b74d3b93cb9e7b5e775e9e1ae909a4dd4917453edfeeff99874ce?d=identicon)[desarrollohola](/maintainers/desarrollohola)

---

Top Contributors

[![enriquesomolinos](https://avatars.githubusercontent.com/u/6418156?v=4)](https://github.com/enriquesomolinos "enriquesomolinos (5 commits)")[![smoreno-hola](https://avatars.githubusercontent.com/u/63701579?v=4)](https://github.com/smoreno-hola "smoreno-hola (1 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationloginradius

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/holadev-oauth2-loginradius/health.svg)

```
[![Health](https://phpackages.com/badges/holadev-oauth2-loginradius/health.svg)](https://phpackages.com/packages/holadev-oauth2-loginradius)
```

###  Alternatives

[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[omines/oauth2-gitlab

GitLab OAuth 2.0 Client Provider for The PHP League OAuth2-Client

36721.5k13](/packages/omines-oauth2-gitlab)

PHPackages © 2026

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