PHPackages                             ohmy/auth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. ohmy/auth

AbandonedArchivedLibrary[Authentication &amp; Authorization](/categories/authentication)

ohmy/auth
=========

OAuth so easy.. you won't even believe it's OAuth

0.0.7(12y ago)101365.4k↓10.4%1[5 PRs](https://github.com/sudocode/ohmy-auth/pulls)1New BSDPHPPHP &gt;=5.3.0

Since Jan 31Pushed 7y ago1 watchersCompare

[ Source](https://github.com/sudocode/ohmy-auth)[ Packagist](https://packagist.org/packages/ohmy/auth)[ Docs](https://github.com/sudocode/ohmy-auth)[ RSS](/packages/ohmy-auth/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)DependenciesVersions (8)Used By (1)

ohmy-auth [![Build Status](https://camo.githubusercontent.com/a510c97a29e53ab98761475c0905151470a8b87d1bd059e3c35c13bf05db8759/68747470733a2f2f7472617669732d63692e6f72672f7375646f636f64652f6f686d792d617574682e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/sudocode/ohmy-auth) [![Scrutinizer Quality Score](https://camo.githubusercontent.com/adb465b5a604b1f1b552ff8f6c26ecf05d77a89793ef11a705125b0cd53b7770/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7375646f636f64652f6f686d792d617574682f6261646765732f7175616c6974792d73636f72652e706e673f733d30646238666232303431306632383938306438353930373435333132393537353232623731663065)](https://scrutinizer-ci.com/g/sudocode/ohmy-auth/) [![License](https://camo.githubusercontent.com/350c3f9126a3277e93099700901ee239ebb3f2fc1f30acacc9d46caee522b2dc/68747470733a2f2f706f7365722e707567782e6f72672f6f686d792f617574682f6c6963656e73652e706e67)](https://packagist.org/packages/ohmy/auth)
=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#ohmy-auth---)

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

[](#dependencies)

Oma only requires PHP (&gt;= 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

[](#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

[](#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

[](#two-legged-oauth-10a)

```
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

[](#three-legged-oauth-10a)

*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

[](#three-legged-oauth-20)

```
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

[](#more-examples)

- [Facebook](https://github.com/sudocode/ohmy-auth/blob/master/examples/facebook.php)
- [Fitbit](https://github.com/sudocode/ohmy-auth/blob/master/examples/fitbit.php)
- [GitHub](https://github.com/sudocode/ohmy-auth/blob/master/examples/github.php)
- [Google+](https://github.com/sudocode/ohmy-auth/blob/master/examples/google.php)
- [Instagram](https://github.com/sudocode/ohmy-auth/blob/master/examples/instagram.php)
- [LinkedIn](https://github.com/sudocode/ohmy-auth/blob/master/examples/linkedin.php)
- [Live](https://github.com/sudocode/ohmy-auth/blob/master/examples/live.php)
- [Tumblr](https://github.com/sudocode/ohmy-auth/blob/master/examples/tumblr.php)
- [Twitter](https://github.com/sudocode/ohmy-auth/blob/master/examples/twitter.php)
- [Yahoo](https://github.com/sudocode/ohmy-auth/blob/master/examples/yahoo.php)

### Licenses

[](#licenses)

- **PHP license**: PHP License
- **ohmy-auth**: New BSD License.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community12

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 65.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~11 days

Recently: every ~17 days

Total

7

Last Release

4419d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8fb76650b0a5f4667c3a30daa268ef2a1880ac3a18334065113a419a2abdd5ce?d=identicon)[sudocoder](/maintainers/sudocoder)

---

Top Contributors

[![dotprodcom](https://avatars.githubusercontent.com/u/102049552?v=4)](https://github.com/dotprodcom "dotprodcom (74 commits)")[![sudocode](https://avatars.githubusercontent.com/u/522221?v=4)](https://github.com/sudocode "sudocode (39 commits)")

---

Tags

deprecatedoauth

### Embed Badge

![Health badge](/badges/ohmy-auth/health.svg)

```
[![Health](https://phpackages.com/badges/ohmy-auth/health.svg)](https://phpackages.com/packages/ohmy-auth)
```

###  Alternatives

[league/oauth2-server

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

6.6k136.0M248](/packages/league-oauth2-server)[league/oauth2-client

OAuth 2.0 Client Library

3.8k118.6M1.2k](/packages/league-oauth2-client)[league/oauth1-client

OAuth 1.0 Client Library

99898.8M106](/packages/league-oauth1-client)[knpuniversity/oauth2-client-bundle

Integration with league/oauth2-client to provide services

84016.7M61](/packages/knpuniversity-oauth2-client-bundle)[socialiteproviders/manager

Easily add new or override built-in providers in Laravel Socialite.

42542.0M544](/packages/socialiteproviders-manager)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

42121.2M118](/packages/league-oauth2-google)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
