/php-2-legged-oauth

Example implementation of 2-legged OAuth

Primary LanguagePHP

Example implementation of 2-legged OAuth with Silex (Inspired from Designing a Secure REST (Web) API without OAuth)

Build Status

Installation

With Composer, install all dependencies.

curl -s https://getcomposer.org/installer | php
php composer.phar install

Usage

Set api clients to config.php

Hash::setClients(array(
    'A_CLIENT'       => 'A_CLIENT_SECRET_KEY',
    'ANOTHER_CLIENT' => 'ANOTHER_CLIENT_SECRET_KEY',
));

API design is in the api.php. Change routes according to your needs. But don't remove hash validation middleware. Then check index.php to see how make an api call.