All Projects → sudocode → Ohmy Auth

sudocode / Ohmy Auth

Licence: bsd-3-clause
OAuth made easy for PHP (deprecated)

Projects that are alternatives of or similar to Ohmy Auth

Sphero Mac Sdk
🚫 DEPRECATED: Sphero SDK for the Mac platform.
Stars: ✭ 70 (-28.57%)
Mutual labels:  deprecated
Framework7 With Angularjs Demo App
⛔️ Unmaintained and deprecated!
Stars: ✭ 81 (-17.35%)
Mutual labels:  deprecated
Notifier For Github Safari
Safari extension - Displays your GitHub notifications unread count
Stars: ✭ 90 (-8.16%)
Mutual labels:  deprecated
Formspopup
Xamarin.Forms Popup View
Stars: ✭ 75 (-23.47%)
Mutual labels:  deprecated
Vagrant Librarian Chef
*UNMAINTAINED* A Vagrant plugin to install Chef cookbooks using Librarian-Chef.
Stars: ✭ 80 (-18.37%)
Mutual labels:  deprecated
Sass Rails Source Maps
DEPRECATED: Rails gem for generating sass source maps
Stars: ✭ 88 (-10.2%)
Mutual labels:  deprecated
Entware Ng
Entware-ng
Stars: ✭ 1,157 (+1080.61%)
Mutual labels:  deprecated
React Combinators
[NOT MAINTAINED] Seamless combination of React and reactive programming
Stars: ✭ 95 (-3.06%)
Mutual labels:  deprecated
Angular2 Style Guide
[Deprecated] Community-driven set of best practices and style guidelines for Angular 2 application development
Stars: ✭ 1,237 (+1162.24%)
Mutual labels:  deprecated
Julian
⛔️DEPRECATED Brilliantly clever PHP calendar class
Stars: ✭ 89 (-9.18%)
Mutual labels:  deprecated
Waxosuit
(deprecated in favor of wascc-host)
Stars: ✭ 76 (-22.45%)
Mutual labels:  deprecated
Adminbar
DEPRECATED – Front-end shortcuts for clients logged into Craft CMS.
Stars: ✭ 77 (-21.43%)
Mutual labels:  deprecated
Plum
A deployer library for PHP 5.3
Stars: ✭ 88 (-10.2%)
Mutual labels:  deprecated
Kirby Twig
Twig templating support for Kirby CMS 2. For Kirby 3, use https://github.com/amteich/kirby-twig
Stars: ✭ 73 (-25.51%)
Mutual labels:  deprecated
Secretary
DEPRECATED Secrets management for dynamic environments
Stars: ✭ 93 (-5.1%)
Mutual labels:  deprecated
Grunt Myth
Myth - Postprocessor that polyfills CSS
Stars: ✭ 70 (-28.57%)
Mutual labels:  deprecated
Codeigniter Schema
⛔️DEPRECATED Expressive table definitions
Stars: ✭ 87 (-11.22%)
Mutual labels:  deprecated
Haha
DEPRECATED Java library to automate the analysis of Android heap dumps.
Stars: ✭ 1,337 (+1264.29%)
Mutual labels:  deprecated
Gphotos Sync
DEPRECATED - Google Photos Simple Synchronization Tool
Stars: ✭ 94 (-4.08%)
Mutual labels:  deprecated
Gulp Ngmin
[DEPRECATED] Pre-minify AngularJS apps with ngmin
Stars: ✭ 89 (-9.18%)
Mutual labels:  deprecated

ohmy-auth Build Status Scrutinizer Quality Score License

ohmy-auth (Oma) is a PHP library that simplifies OAuth into a fluent interface:

use ohmy\Auth1;
Auth1::legs(2)
     ->set('key', 'key')
     ->set('secret', 'secret')
     ->request('http://term.ie/oauth/example/request_token.php')
     ->access('http://term.ie/oauth/example/access_token.php')
     ->GET('http://term.ie/oauth/example/echo_api.php')
     ->then(function($data) {
         # got data
     });

Dependencies

Oma only requires PHP (>= 5.3) and the usual extensions for Curl (curl_init(), curl_setopt(), etc), JSON (json_encode(), json_decode()) and sessions (session_start(), session_destroy()).

Installing with Composer

The best way to install Oma is via Composer. Just add ohmy/auth to your project's composer.json and run composer install. eg:

{
    "require": {
        "ohmy/auth": "*"
    }
}

Installing manually

If you prefer not to use Composer, you can download an archive or clone this repo and put src/ohmy into your project setup.

Two-Legged OAuth 1.0a

use ohmy\Auth1;

# do 2-legged oauth
$termie = Auth1::legs(2)
               # configuration
               ->set('key', 'key')
               ->set('secret', 'secret')
               # oauth flow
               ->request('http://term.ie/oauth/example/request_token.php')
               ->access('http://term.ie/oauth/example/access_token.php');

# api call
$termie->GET('http://term.ie/oauth/example/echo_api.php')
       ->then(function($data) {
           # got data
       });

Three-Legged OAuth 1.0a

Note: This requires sessions in order to save data between redirects. This will not work properly without sessions!

use ohmy\Auth1;

# do 3-legged oauth
$tumblr = Auth1::legs(3)
               # configuration
               ->set(array(
                    'consumer_key'    => 'your_consumer_key',
                    'consumer_secret' => 'your_consumer_secret',
                    'callback'        => 'your_callback_url'
               ))
               # oauth flow
               ->request('http://www.tumblr.com/oauth/request_token')
               ->authorize('http://www.tumblr.com/oauth/authorize')
               ->access('http://www.tumblr.com/oauth/access_token');

# access tumblr api      
$tumblr->GET('https://api.tumblr.com/v2/user/info')
       ->then(function($data) {
           # got user data
       });

Three-Legged OAuth 2.0

use ohmy\Auth2;

# do 3-legged oauth
$github = Auth2::legs(3)
               # configuration
               ->set(array(
                    'id'       => 'your_github_client_id',
                    'secret'   => 'your_github_client_secret',
                    'redirect' => 'your_redirect_uri'
               ))
               # oauth flow
               ->authorize('https://github.com/login/oauth/authorize')
               ->access('https://github.com/login/oauth/access_token')
               ->finally(function($data) use(&$access_token) {
                   $access_token = $data['access_token'];
               });

# access github api
$github->GET("https://api.github.com/user?access_token=$access_token", null, array('User-Agent' => 'ohmy-auth'))
       ->then(function($data) {
           # got user data
       });

More examples

Licenses

  • PHP license: PHP License
  • ohmy-auth: New BSD License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].