Download the PHP package webiny/oauth2 without Composer
On this page you can find all versions of the php package webiny/oauth2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webiny/oauth2
More information about webiny/oauth2
Files in webiny/oauth2
Package oauth2
Short Description Webiny OAuth2 Component
License MIT
Homepage http://www.webiny.com/
Informations about the package oauth2
OAuth2 Wrappers
This component provides wrappers for several OAuth2 systems like Facebook, LinkedIn and Google. After you have gained OAuth2 access token, you can use this wrapper to communicate with the the desired service.
Install the component
The best way to install the component is using Composer.
For additional versions of the package, visit the Packagist page.
Supported OAuth2 servers
Current supported OAuth2 servers are:
Configuring the component
To use the component, you first need to configure it. The configuration is done by defining the following params:
- Server - class that will be used to process the response from OAuth2 server
- ClientId - OAuth2 client id
- ClientSecret - OAuth2 client secret
- Scope - scope parameter based on the selected OAuth2 server
- RedirectUri - location where the user will be redirected by the OAuth2 server once he is authorized
Example configuration:
Usage
This component depends on users access token, without it no API call to the OAuth2 server can be made.
To get the access token, please read the implementation guide for a specific server you wish to use.
OAuth2 components is also integrated with the Security
component as a user and authentication provider, automating the process of getting the required auth token.
Example:
Registering additional servers
First create a class that extends \Webiny\Component\OAuth2\AbstractServer
and then implement the abstract methods.
All of the abstract methods are described inside AbstractServer
class, and additionally you should also check out how
implementations of current servers looks like. They are located in \Webiny\Component\OAuth2\Server
folder.
Once you have implemented your logic for the abstract methods, it's time to register the class with the OAuth2 component.
In order to do so, inside your config file, set the value of Server
property to your newly created class.
And you're done! To use it, just configure it the same way as the built in classes.
Notice
The code on this component is not fully covered by unit test. Only main classes are tested, while tests for Bridge
and Server
still need to be written.
Resources
To run unit tests, you need to use the following command:
$ cd path/to/Webiny/Component/OAuth2/
$ composer.phar install
$ phpunit
All versions of oauth2 with dependencies
webiny/http Version ~1.6
webiny/config Version ~1.6
webiny/std-lib Version ~1.6
league/oauth2-client Version 0.8.*