Uses the DynamoDB NoSQL Database Service for storing and retrieving objects in OAuth.


First, you will need to install the Amazon Web Services PHP SDK

$ composer require aws/aws-sdk-php:dev-master

Get Started

If you haven’t already created an ~/.aws/credentials file, this is the easiest way to get up and running with DynamoDB.

// @see http://docs.aws.amazon.com/aws-sdk-php/guide/latest/credentials.html#credential-profiles
$config = array(
        'profile' => 'default',
        'region'  =>  Aws\Common\Enum\Region::US_EAST_1, // Your region may differ

Alternatively, you can configure your client to run directly with your credentials

// These credentials are found in your AWS management console
$config = array(
        'key'         => 'my-aws-key',
        'secret' => 'my-aws-secret',
        'region' => Aws\Common\Enum\Region::US_EAST_1, // Your region may differ

Next, instantiate the AWS client by creating your configuration array and using the factory method:

$dynamo = Aws\DynamoDb\DynamoDbClient::factory($config);

Finally, create the storage object using the DynamoDB storage class:

$storage = new OAuth2\Storage\DynamoDB($dynamo);

// now you can perform storage functions, such as the one below
$storage->setClientDetails($client_id, $client_secret, $redirect_uri);

To see an example of the default table structure, check out the Bootstrap::createDynamoDB function in this library, or just create the tables yourself using DynamoDB’s management UI.


The DynamoDB storage engine implements all the standard Storage Interfaces supported in this library. See interfaces for more information.

Fork me on GitHub