Download the PHP package idci/guzzle-bundle-knpu-oauth2-plugin without Composer
On this page you can find all versions of the php package idci/guzzle-bundle-knpu-oauth2-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package guzzle-bundle-knpu-oauth2-plugin
Guzzle Bundle KnpU OAuth2 Plugin
This bundle integrates KnpU OAuth2 functionality using a Guzzle Bundle plugin.
This bundle was highly inspired by the work of this: gregurco/guzzle-bundle-oauth2-plugin. The OAuth2 negociation to retrieved the AccessToken is handle with knpuniversity/oauth2-client-bundle and league/oauth2-client.
Installation
With composer:
Enable bundle
Overrides the registerBundles
function in src/Kernel.php
like this:
Configuration
Configure your KnpUOAuth2 client as described into the offical documentation into config/packages/knpu_oauth2_client.yaml
.
Here is an example using a Keycloak client:
Then when you wants to automatically add a bearer token to your Guzzle client request, simply use the knpu_oauth2
plugin configuration into config/packages/eight_points_guzzle.yaml
.
Here is an example that use the my_keycloak_client
KnpUOAuth2 client:
If you wants to store your bearer token, you can use the persistent
option to true.
By default this bundle use the cache.app
service to store the bearer token, but you can change this with the cache_service_id
option.
Here is an example that store your bearer token using a custom Symfony\Component\Cache\Adapter\RedisAdapter
service.
config/services.yaml
:
config/packages/cache.yaml
:
config/packages/eight_points_guzzle.yaml
:
All versions of guzzle-bundle-knpu-oauth2-plugin with dependencies
knpuniversity/oauth2-client-bundle Version ^2.0
symfony/cache Version ^5.3|^6.0
symfony/config Version ^5.3|^6.0
symfony/dependency-injection Version ^5.3|^6.0
symfony/http-kernel Version ^5.3|^6.0