PHPackages                             nyan02/kphp\_oauth2\_keycloak - 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. nyan02/kphp\_oauth2\_keycloak

ActiveLibrary

nyan02/kphp\_oauth2\_keycloak
=============================

Keycloak Client Provider for KPHP OAuth2 Client

1.0.0(3y ago)09MITPHPPHP &gt;=7.4

Since Apr 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/catnyan02/kphp_oauth2_keycloak)[ Packagist](https://packagist.org/packages/nyan02/kphp_oauth2_keycloak)[ RSS](/packages/nyan02-kphp-oauth2-keycloak/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

This package provides Keycloak OAuth 2.0 support for the KPHP

### Installation

[](#installation)

To install, use composer:

`composer require nyan02/kphp_oauth2_keycloak `

### Usage

[](#usage)

Usage is similar to KPHP OAuth client, using nyan02\\kphp\_oauth2\_client\\Provider\\Keycloak as the provider.

You need to create a new Provider object specifying keycloak-client-id, keycloak-client-secret and callback-url.

The main difference from generic provider class is that you have to set Keycloak specific parameters: AuthServerUrl and Realm. You can also set your Keycloak version (this will change the default scopes).

If you've configured your Keycloak instance to use encryption, there are some advanced options available to you. You can configure the provider to use the same encryption algorithm and to use the expected decryption public key or certificate. You can set the key either by specifying the path or by directly passing the contents.

You can see the example below.

### Authorization Code Example

[](#authorization-code-example)

```
