PHPackages                             alphalabs/oauth2-client - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. alphalabs/oauth2-client

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

alphalabs/oauth2-client
=======================

A PHP OAuth2 API client. Works well with friendofsymfony/oauth2-php specification.

5161[1 issues](https://github.com/AlphaLabs/OAuth2Client/issues)PHP

Since Jan 7Pushed 12y ago1 watchersCompare

[ Source](https://github.com/AlphaLabs/OAuth2Client)[ Packagist](https://packagist.org/packages/alphalabs/oauth2-client)[ RSS](/packages/alphalabs-oauth2-client/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

AlphaLabs OAuth2 client
=======================

[](#alphalabs-oauth2-client)

[![Latest Stable Version](https://camo.githubusercontent.com/746987ae78c685a2ca5c8e15f7e841a98c455ca603bec94f6dd5a55f990a210c/68747470733a2f2f706f7365722e707567782e6f72672f616c7068616c6162732f6f61757468322d636c69656e742f762f737461626c652e706e67)](https://packagist.org/packages/alphalabs/oauth2-client) [![Latest Unstable Version](https://camo.githubusercontent.com/8cd1cf9f340fb30697c3e6a6df9f12a48d25439e6841a684c2bfdcc5c2e5a180/68747470733a2f2f706f7365722e707567782e6f72672f616c7068616c6162732f6f61757468322d636c69656e742f762f756e737461626c652e706e67)](https://packagist.org/packages/alphalabs/oauth2-client) [![SensioLabsInsight](https://camo.githubusercontent.com/4f0290a804a16b5bc40cee03a3cedc0662e8581e18c406068ee87c1ccb792c42/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f66646262386239622d313462362d346433312d616466332d6336366430663765383734362f6d696e692e706e67)](https://insight.sensiolabs.com/projects/fdbb8b9b-14b6-4d31-adf3-c66d0f7e8746)

> A PHP OAuth2 API client. Works well with friendofsymfony/oauth2-php specification

This library is build over [Guzzle](https://github.com/guzzle/guzzle) and adds OAuth2 authentication mechanisms to make secured and user-oriented API calls.

The API client follow the OAuth2 specification which are applied in the [friendofsymfony/oauth2-php](https://github.com/FriendsOfSymfony/oauth2-php) library and the [friendsofsymfony/oauth-server-bundle](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle).

For the moment, the library provides the following features:

- **Oauth2 transparent authentication**: Make the initial resource request, the library will request access token if needed transparently.
- **Resource deserialization**: An instance of the [JMS Serializer](https://github.com/schmittjoh/serializer) can be provided to the API client. Thus, if the target ressource class is linked to the request, the API client will try to deserialize the response data into the target object.

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

[](#installation)

Adds the library in your `composer.json` file:

```
"require": {
    "alphalabs/oauth2-client": "1.0@dev"
}
```

Don't forget to update your dependencies with `composer update`

Usage
-----

[](#usage)

Starts by create a class which implements `AlphaLabs\OAuth2Client\Model\Security\TokenManager`. This manager will handle the persistence strategy of the access tokens between requests.

```
