ehough/coauthor

OAuth client backed by ehough/shortstop

This package's canonical repository appears to be gone and the package has been frozen as a result.

v1.0.0 2013-08-27 20:35 UTC

This package is not auto-updated.

Last update: 2019-02-27 11:08:49 UTC


README

Build Status Project Status: Unsupported - The project has reached a stable, usable state but the author(s) have ceased all work on it. A new maintainer may be desired. Latest Stable Version License

This library is no longer maintained. OAuth library designed for ehough/shortstop integration.

Features

  • Adheres as closely as possible to RFC 5894
  • Excellent test coverage
  • OAuth 1.x only - for now

Sample Usage

//instance of ehough_shortstop_api_HttpClientInterface
$httpClient = ...

//instance of ehough_coauthor_spi_v1_TemporaryCredentialsStorageInterface
$credentialsStorage = new ehough_coauthor_impl_v1_SessionCredentialsStorage();

//instance of ehough_coauthor_spi_v1_SignerInterface
$signer = new ehough_coauthor_impl_v1_Signer();

//instance of ehough_coauthor_spi_v1_RemoteCredentialsFetcherInterface
$credentialsFetcher = new ehough_coauthor_impl_v1_DefaultRemoteCredentialsFetcher($httpClient, $signer);

//instance of ehough_coauthor_api_v1_ClientInterface
$client = new ehough_coauthor_impl_v1_DefaultV1Client($credentialsFetcher, $credentialsStorage, $signer);

//build client credentials
$clientCredentials = new ehough_coauthor_api_v1_Credentials('identifier', 'secret');


//will fetch and store temporary credentials in a PHP session, then redirect to the given URL
$client->commenceNewAuthorization($server, 'http://something.com/oauth/fetchTokens.php', $clientCredentials);

OR

//will fetch new token/access credentials
$token = $client->fetchTokenCredentials($server, 'credentials-id', 'verification-code', $clientCredentials);

OR

//will sign a single HTTP request, with the optional $token credentials
$client->sign($request, $clientCredentials, $token);