PHPackages                             gabsi/spryker-social-oauth - 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. gabsi/spryker-social-oauth

ActiveLibrary

gabsi/spryker-social-oauth
==========================

Social OAuth Module for Spryker

01.9k

Since Mar 2Pushed 3y agoCompare

[ Source](https://github.com/Gabsii/spryker-social-oauth)[ Packagist](https://packagist.org/packages/gabsi/spryker-social-oauth)[ RSS](/packages/gabsi-spryker-social-oauth/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

TowaSprykerOauth Module
=======================

[](#towasprykeroauth-module)

[![Minimum PHP Version](https://camo.githubusercontent.com/0e9ac047546796cfdbe1423d1f4d91c8f37d2fbb11614a7900bb7686aaa5401f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e342d3838393242462e737667)](https://php.net/)

A Spryker wrapper for [`knpuniversity/oauth2-client-bundle`](https://github.com/knpuniversity/oauth2-client-bundle)

Installation
============

[](#installation)

```
docker/sdk cli composer require "towa/spryker-social-oauth" --no-update
docker/sdk cli composer update "towa/spryker-social-oauth"
```

Usage
=====

[](#usage)

Configuration
-------------

[](#configuration)

In your `config_default.php` add your provider configuration. E.g.

```
// config-default.php

use Towa\Service\TowaSprykerOauth\TowaSprykerOauthConstants;

$config[TowaSprykerOauthConstants::TOWA_SPRYKER_AUTH_CONFIG] = [
    'github' => [
        'clientId'          => '{github-client-id}',
        'clientSecret'      => '{github-client-secret}',
        'redirectUri'       => 'https://example.com/callback-url',
    ],
    'google' => [
        'clientId'     => '{google-client-id}',
        'clientSecret' => '{google-client-secret}',
        'redirectUri'  => 'https://example.com/callback-url',
        'hostedDomain' => 'example.com', // optional; used to restrict access to users on your G Suite/Google Apps for Business accounts
    ]
]

```

> Make sure you have the correct client installed for your provider. Please refer to

Add the Towa Namespace to the Core Namespaces.

```
// config_default.php

$config[KernelConstants::CORE_NAMESPACES] = [
    ...
    'Towa'
];

```

Agent Configuration
-------------------

[](#agent-configuration)

Extend the SecurityApplicationPlugin on Project level.

```
// Pyz\Yves\Security\Plugin\Application\SecurityApplicationPlugin

class SecurityApplicationPlugin extends SprykerSecurityApplicationPlugin
{
    public const SERVICE_SECURITY_AUTHENTICATION_PROVIDER_TOWA = 'security.authentication_provider.agent.dao';

    /**
     * @param \Spryker\Service\Container\ContainerInterface $container
     *
     * @return \Spryker\Service\Container\ContainerInterface
     */
    protected function addListenerPrototypes(ContainerInterface $container): ContainerInterface
    {
        $container = $this->addTowaAuthenticator($container);
        $container = parent::addListenerPrototypes($container);

        return $container;
    }

    /**
     * @param \Spryker\Service\Container\ContainerInterface $container
     *
     * @return \Spryker\Service\Container\ContainerInterface
     */
    protected function addAuthenticationProviderPrototypes(ContainerInterface $container): ContainerInterface
    {
        $container = parent::addAuthenticationProviderPrototypes($container);
        $container = $this->addTowaAuthenticationProvider($container);

        return $container;
    }

    /**
     * @param \Spryker\Service\Container\ContainerInterface $container
     *
     * @return \Spryker\Service\Container\ContainerInterface
     */
    private function addTowaAuthenticator(ContainerInterface $container): ContainerInterface
    {
        $container->set(
            AgentAuthenticator::AUTHENTICATOR_KEY,
            new AgentAuthenticator(
                $this->getFactory()->getProvider(),
                $this->getFactory()->getProviderClient(),
                $this->getFactory()->getUserClient(),
            )
        );

        return $container;
    }

    /**
     * @param \Spryker\Service\Container\ContainerInterface $container
     *
     * @return \Spryker\Service\Container\ContainerInterface
     */
    protected function addTowaAuthenticationProvider(ContainerInterface $container): ContainerInterface
    {
        $container->set(
            static::SERVICE_SECURITY_AUTHENTICATION_PROVIDER_KEYCLOAK,
            new AgentAuthenticationProvider(
                $container->get(AgentAuthenticator::AUTHENTICATOR_KEY),
                $this->getFactory()->createAgentUserProvider(),
                new UserChecker()
            )
        );

        return $container;
    }
}
```

In the SecurityFactory you now need to add functions for the proper Provider and Client.

```
// Pyz\Yves\Security\Plugin\Application\SecurityApplicationPlugin

class SecurityFactory extends SprykerSecurityFactory
{
    /**
     * @return \Pyz\Yves\Security\Dependency\Client\SecurityToCustomerClientInterface
     */
    public function getCustomerClient(): SecurityToCustomerClientInterface
    {
        return $this->getProvidedDependency(SecurityDependencyProvider::CLIENT_CUSTOMER);
    }

    /**
     * @return \Pyz\Client\User\UserClientInterface
     */
    public function getUserClient(): UserClientInterface
    {
        return $this->getProvidedDependency(SecurityDependencyProvider::CLIENT_USER);
    }

    /**
     * @return \Towa\Service\TowaSprykerOauth\TowaSprykerOauthServiceInterface
     */
    public function getTowaOauthService(): TowaOauthServiceInterface
    {
        return $this->getProvidedDependency(SecurityDependencyProvider::SERVICE_TOWAOAUTH);
    }

    /**
     * @return \League\OAuth2\Client\Provider\AbstractProvider
     */
    public function getProvider(): AbstractProvider
    {
        return $this->getTowaOauthService()->getSocialOauthProvider('github'); // replace github with whichever provider you are using
    }

    /**
     * @return \KnpU\OAuth2ClientBundle\Client\OAuth2ClientInterface
     */
    public function getProviderClient(): OAuth2ClientInterface
    {
        return $this->getTowaOauthService()->getSocialOauthClient('github'); // replace github with whichever provider you are using
    }

    /**
     * @return \Symfony\Component\Security\Core\User\UserProviderInterface
     */
    public function createAgentUserProvider(): UserProviderInterface
    {
        return new AgentUserProvider();
    }
}

```

Adjust the DependencyProvider

```
class SecurityDependencyProvider extends SprykerSecurityDependencyProvider
{
    public const CLIENT_CUSTOMER = 'CLIENT_CUSTOMER';
    public const SERVICE_TOWAOAUTH = 'SERVICE_TOWAOAUTH';
    public const CLIENT_USER = 'CLIENT_USER';

    /**
     * @param \Spryker\Yves\Kernel\Container $container
     *
     * @return \Spryker\Yves\Kernel\Container
     */
    public function provideDependencies(Container $container): Container
    {
        $container = parent::provideDependencies($container);

        $container = $this->addCustomerClient($container);
        $container = $this->addTowaOauthService($container);
        $container = $this->addUserClient($container);

        return $container;
    }

    /**
     * @param \Spryker\Yves\Kernel\Container $container
     *
     * @return \Spryker\Yves\Kernel\Container
     */
    protected function addCustomerClient(Container $container): Container
    {
        $container->set(static::CLIENT_CUSTOMER, function (Container $container): SecurityToCustomerClientInterface {
            return new SecurityToCustomerClientBridge(
                $container->getLocator()->customer()->client()
            );
        });

        return $container;
    }

    /**
     * @param \Spryker\Yves\Kernel\Container $container
     *
     * @return \Spryker\Yves\Kernel\Container
     */
    private function addTowaOauthService(Container $container): Container
    {
        $container->set(static::SERVICE_TOWAOAUTH, function (Container $container): TowaOauthServiceInterface {
            return $container->getLocator()->TowaSprykerOauth()->service();
        });

        return $container;
    }

    /**
     * @param \Spryker\Yves\Kernel\Container $container
     *
     * @return \Spryker\Yves\Kernel\Container
     */
    private function addUserClient(Container $container): Container
    {
        $container->set(static::CLIENT_USER, function (Container $container): UserClientInterface {
            return $container->getLocator()->user()->client();
        });

        return $container;
    }
}

```

Yves Configuration
------------------

[](#yves-configuration)

TODO

Zed Configuration
-----------------

[](#zed-configuration)

TODO

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor1

Top contributor holds 62.8% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4aa46b745c3d977a9a5c272bd20639d01dc3bd062359fc797ce2dfac38cca2c2?d=identicon)[polyakz](/maintainers/polyakz)

![](https://avatars.githubusercontent.com/u/23434539?v=4)[Lukas Gabsi](/maintainers/Gabsii)[@Gabsii](https://github.com/Gabsii)

---

Top Contributors

[![Gabsii](https://avatars.githubusercontent.com/u/23434539?v=4)](https://github.com/Gabsii "Gabsii (27 commits)")[![fabio-towa](https://avatars.githubusercontent.com/u/77491577?v=4)](https://github.com/fabio-towa "fabio-towa (7 commits)")[![zoltanpolyak](https://avatars.githubusercontent.com/u/214793328?v=4)](https://github.com/zoltanpolyak "zoltanpolyak (7 commits)")[![polyakz](https://avatars.githubusercontent.com/u/27897571?v=4)](https://github.com/polyakz "polyakz (1 commits)")[![simonrauch](https://avatars.githubusercontent.com/u/17831964?v=4)](https://github.com/simonrauch "simonrauch (1 commits)")

### Embed Badge

![Health badge](/badges/gabsi-spryker-social-oauth/health.svg)

```
[![Health](https://phpackages.com/badges/gabsi-spryker-social-oauth/health.svg)](https://phpackages.com/packages/gabsi-spryker-social-oauth)
```

PHPackages © 2026

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