Download the PHP package beyondbluesky/oauth2-pkce-client without Composer

On this page you can find all versions of the php package beyondbluesky/oauth2-pkce-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package oauth2-pkce-client

OAuth2 PKCE Enabled client

This Symfony bundle allows a Symfony4/5/6 installation authenticate it's users against an OAuth2 compliant server using the PKCE extension.

The PKCE extension RFC-7636 (https://tools.ietf.org/html/rfc7636) adds additional security to the OAuth2 protocol and it will be mandatory on future versions of OAuth2.

This implementation requires the generation of:

Following you'll find all the steps to configure it. Don't worry...

Installation

To install it you need to follow the following stemps:

  1. Download the latest version of the bundle

  2. Configure the endpoints of your OAuth2 server with a file at config/packages named oauth2_pkce_client:

config/packages/oauth2_pkce_client.yaml:

  1. Create a Controller to receive the tokens, that has to match the redirect_uri path. Following we provide an example code for you to adapt:

src/Controller/OAuth2Controller.php:

  1. Create a user class. The minimum information should be the username. All other fields are optional and filled in the point 5 of this guide. In our case we'll create a Security\User inside the Entity folder.

If you are new to this, I highly recommend to use the command

And follow the questions asked, adding the username field and all the fields you need for your project. That will generate an ORM configured entity with all the information needed.

Once you have created your user, edit it and implement the UserInterface interface to tell Symfony your user entity is a Symfony User:

With the implementation of the UserInterface you'll have to add a few Symfony functions:

  1. Now we need a new Authenticator. Use to following code as a template. Take into consideration the getUser function, you'll have to fill your user object with the fields that you'll receive from your OAuth2 server. Yo can var_dump the oauthUser if you are not sure what you are receiving:

src/Security/OAuth2Authenticator.php:

  1. Update your database schema: schema:update or doctrine:migrations, your choice.

  2. Configure the security.yaml to point to our new authenticator

On the providers section replace the in-memory line for:

config/packages/security.yaml:

And on firewalls > main refer to your new user provider and add our authenticator created at step 5:

  1. Enjoy your new OAuth2 authentication! For that go to your Symfony root on a browser and add a oauth2/login to the URL (if you didn't change the paths on the OAuth2Controller). Now you should see the login page of your OAuth2 server.

Have fun!


All versions of oauth2-pkce-client with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
symfony/framework-bundle Version ^5.1|^5.2|^6.3
symfony/dependency-injection Version ^5.1|^5.2|^6.3
symfony/routing Version ^5.1|^5.2|^6.3
symfony/http-foundation Version ^5.1|^5.2|^6.3
beyondbluesky/lib-jwt Version 1.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package beyondbluesky/oauth2-pkce-client contains the following files

Loading the files please wait ....