PHPackages                             knojector/steam-authentication-bundle - 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. knojector/steam-authentication-bundle

ActiveSymfony-bundle

knojector/steam-authentication-bundle
=====================================

Symfony Bundle to integrate Steam authentication

1.4.0(2y ago)1115.4k↓26.9%8[1 PRs](https://github.com/knojector/SteamAuthenticationBundle/pulls)MITPHPPHP &gt;=8.2

Since Feb 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/knojector/SteamAuthenticationBundle)[ Packagist](https://packagist.org/packages/knojector/steam-authentication-bundle)[ RSS](/packages/knojector-steam-authentication-bundle/feed)WikiDiscussions main Synced 1mo ago

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

[![GitHub license](https://camo.githubusercontent.com/063db058be27ee5dbed848ddb666cf0a01363aa2bb97f3473dc9c9f1b5b0b1ba/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6b6e6f6a6563746f722f537465616d41757468656e7469636174696f6e42756e646c65)](https://github.com/knojector/SteamAuthenticationBundle/blob/main/LICENSE)[![GitHub issues](https://camo.githubusercontent.com/996e06a60057fca96025d21529535cc156d42cdbd3323c9ef269d8639a742dba/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6b6e6f6a6563746f722f537465616d41757468656e7469636174696f6e42756e646c65)](https://github.com/knojector/SteamAuthenticationBundle/issues)[![GitHub issues](https://camo.githubusercontent.com/d5a025067d29d265ef54b338d4cca94025ec733257b3c6bd25a4ee45748498bb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f6b6e6f6a6563746f722f537465616d41757468656e7469636174696f6e42756e646c65)](https://github.com/knojector/SteamAuthenticationBundle/pulls)[![GitHub issues](https://camo.githubusercontent.com/b52f5127eaebd67823eb5ab8b6c2f5754b9340c0092664aad24e3e634817a7c5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6b6e6f6a6563746f722f537465616d41757468656e7469636174696f6e42756e646c65)](https://github.com/knojector/SteamAuthenticationBundle/stargazers)[![Packagist Downloads](https://camo.githubusercontent.com/60ea16351e83400c66c61c46d3bef12768ac0b491e977503236fbbb9636fcdff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b6e6f6a6563746f722f737465616d2d61757468656e7469636174696f6e2d62756e646c65)](https://camo.githubusercontent.com/60ea16351e83400c66c61c46d3bef12768ac0b491e977503236fbbb9636fcdff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b6e6f6a6563746f722f737465616d2d61757468656e7469636174696f6e2d62756e646c65)

SteamAuthenticationBundle - Steam authentication for Symfony
============================================================

[](#steamauthenticationbundle---steam-authentication-for-symfony)

The SteamAuthenticationBundle provides an easy way to integrate Steams OpenID login for your application.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Bugs and ideas?](#bugs-and-ideas)
- [Requirements](#requirements)

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

[](#installation)

### Step 1 - Install the bundle

[](#step-1---install-the-bundle)

```
composer require knojector/steam-authentication-bundle
```

### Step 2 - Configuration

[](#step-2---configuration)

```
knojector_steam_authentication:
    login_success_redirect: 'app.protected_route'
    login_failure_redirect: 'app.error_route'
```

As you can see there are only two options available for configuration. Both are very self-explanatory. The option `login_success_redirect` contains the name of the route the user should be redirected to if the login was successful. The option `login_failure_redirect` contains the route the user is redirected to if the login fails.

Furthermore you have to adjust your `security.yml`. In the following snippet you can see an example with a basic configuration. There are only two important things to consider:

- The firewall name must be `steam`
- You can use any user provider as long as the Steam CommunityId is the property to query for

```
security:
    providers:
        users:
            entity:
                class: 'App\Entity\User'
                property: 'username'
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        steam:
            pattern: ^/
            lazy: true
            provider: users
```

The final step is to enable the bundle's controller in your `routes.yaml`

```
steam_authentication_callback:
  path: /steam/login_check
  controller: Knojector\SteamAuthenticationBundle\Controller\SteamController::callback
```

Usage
-----

[](#usage)

### Step 1 - Create your own registration subscriber

[](#step-1---create-your-own-registration-subscriber)

Technically there is no registration available in this bundle. The bundle receives an ID from Steam and tries to load a user via the configured user provider. If no user exists you can assume that the user logged in for the first time. Instead of throwing an exception, the bundle dispatches an event you can subscribe to. A simple example for your subscriber is shown below

```
