2017 © Pedro Peláez
 

library oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

image

duncan3dc/oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

  • Thursday, December 28, 2017
  • by duncan3dc
  • Repository
  • 1 Watchers
  • 0 Stars
  • 66,458 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

oauth

Handles non-web based OAuth/OAuth2 authentication along with providers for common services, (*1)

Latest Stable Version build Coverage Status, (*2)

I really don't think you will find these classes useful, if you proceed then don't say I didn't warn you
You are likely looking for thephpleague/oauth1-client or thephpleague/oauth2-client, (*3)

Requirements

  • These classes require use of the sql-class project (for storing authorised credentials)
  • The active database must contain a table called oauth (or know about it via the definitions within the Sql class)
  • The table must have the following schema
`type`      varchar(20),
`username`  varchar(100),
`state`     int(11),
`token`     varchar(100),
`secret`    varchar(100),
UNIQUE KEY `type, username` (`type`,`username`)

OAuth2

The OAuth2 classes require manual intervention to get authorised initially, but once your token/secret are in the database they work like the OAuth classes., (*4)

Examples

Basic twitter example, (*5)

use duncan3dc\OAuth\Twitter;
use duncan3dc\SqlClass\Sql;

Sql::addServer("twitter", [
    "hostname"  =>  "example.com",
    "username"  =>  "my_twitter_app",
    "password"  =>  "secret_password",
    "database"  =>  "twitter",
]);

$twitter = new Twitter([
    "username"  =>  "my_handle",
    "authkey"   =>  "XfHrRTY25FgkyqxDfbpe",
    "secret"    =>  "gwj8c29GHDWdphmQhGtHPx4GybwRfhXplT3CD0VG1n",
]);

# The authorise method returns null if we are already authorised. Otherwise it returns a url to grant at
if ($url = $twitter->authorise()) {
    throw new \Exception("Authorsation failed, grant permission here: " . $url);
}

$userData = $twitter->user("my_handle");
print_($userData);

If you have extended the Sql class (or are using an interface compatible project) you can have the OAuth classes use that class as so, (*6)

use duncan3dc\OAuth\Twitter;
use MrCoder\MyCustom\Sql;

\duncan3dc\OAuth\Sql::useClass(Sql::class);

$twitter = new Twitter([

If your oauth table is not in the active database, then you can let the Sql class know where it is using the following, (*7)

use duncan3dc\OAuth\Twitter;
use duncan3dc\SqlClass\Sql;

Sql::addServer("twitter", [
    "hostname"      =>  "example.com",
    "username"      =>  "my_twitter_app",
    "password"      =>  "secret_password",
    "database"      =>  "twitter",
    "definitions"   =>  ["oauth" => "my_other_database"],
]);

$twitter = new Twitter([

The Versions

28/12 2017

dev-master

9999999-dev https://github.com/duncan3dc/php-oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

oauth oauth2 instagram twitter github lovefilm

08/02 2017

1.3.3

1.3.3.0 https://github.com/duncan3dc/php-oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

  Sources   Download

Apache-2.0

The Requires

 

oauth oauth2 instagram twitter github lovefilm

04/06 2016

1.3.2

1.3.2.0 https://github.com/duncan3dc/php-oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

  Sources   Download

Apache-2.0

The Requires

 

oauth oauth2 instagram twitter github lovefilm

23/03 2015

1.3.1

1.3.1.0 https://github.com/duncan3dc/php-oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

  Sources   Download

Apache-2.0

The Requires

 

oauth oauth2 instagram twitter github lovefilm

27/02 2015

dev-php7

dev-php7 https://github.com/duncan3dc/php-oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

  Sources   Download

Apache-2.0

The Requires

 

oauth oauth2 instagram twitter github lovefilm

23/12 2014

1.3.0

1.3.0.0 https://github.com/duncan3dc/php-oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

  Sources   Download

Apache-2.0

The Requires

 

oauth oauth2 instagram twitter github lovefilm

13/10 2014

1.2.0

1.2.0.0 https://github.com/duncan3dc/php-oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

  Sources   Download

Apache-2.0

The Requires

 

oauth oauth2 instagram twitter github lovefilm

07/09 2014

1.1.3

1.1.3.0 https://github.com/duncan3dc/php-oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

  Sources   Download

Apache-2.0

The Requires

 

oauth oauth2 instagram twitter github lovefilm

27/08 2014

1.1.2

1.1.2.0 https://github.com/duncan3dc/php-oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

  Sources   Download

Apache-2.0

The Requires

 

oauth oauth2 instagram twitter github lovefilm

06/07 2014

1.1.1

1.1.1.0 https://github.com/duncan3dc/php-oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

  Sources   Download

Apache-2.0

The Requires

 

oauth oauth2 instagram twitter github lovefilm

05/07 2014

1.1.0

1.1.0.0 https://github.com/duncan3dc/php-oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

  Sources   Download

Apache-2.0

The Requires

 

oauth oauth2 instagram twitter github lovefilm

04/06 2014

1.0.0

1.0.0.0 https://github.com/duncan3dc/php-oauth

Handles basic OAuth/OAuth2 authentication along with classes for common services

  Sources   Download

Apache-2.0

The Requires

 

oauth oauth2 instagram twitter github lovefilm