PHPackages                             andrew-rose/oauth.php - 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. andrew-rose/oauth.php

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

andrew-rose/oauth.php
=====================

1103PHP

Since Feb 10Pushed 5y ago1 watchersCompare

[ Source](https://github.com/AndrewRose/oauth.php)[ Packagist](https://packagist.org/packages/andrew-rose/oauth.php)[ RSS](/packages/andrew-rose-oauthphp/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

oauth.php
---------

[](#oauthphp)

This little bit of code has one only one aim in life - to allow you to put links to identity providers Google/Microsoft on your login page which allows users to confirm their email address (identity) with a simple click and redirect to your app where if you trust Google/Microsoft you can login the user with the specified email address immediately with no requirement for a username/password, magic.

Currently only Google/Microsoft identify providers are configured but you shouldn't have any issues adding more to oauth.ini.

To install put oauth.php into your web root, configure oauth.ini and place OUTSIDE of your web root with your client id/secrets (see instructions below to obtain) and on your login page embed the login links, you can do this by visiting oauth.php directly and copying the html links and pasting directly onto your login page, or include them directly using jQuery i.e.

```

    jQuery('#sso').load('oauth.php');

```

After the user clicks the link to their identity provider, the provider will authentic them (hopefully) and redirect back to oauth.php with the users email address which can then be used in your own login process i.e.

```
session_start();
$_SESSION['ssoEmail'] = $data[$settings[$idp]['emailIdentifier']];
header('Location: '.$settings['default']['uri']);
session_write_close();
```

The above sets a session variable ssoEmail and then redirects the user to the main application that checks for this session variable and if set will log the user in. You will need to edit the above code in ouath.php if your requirements are more advanced / different.

To register for Google SSO go to  and on the left select Credentials -&gt; Create Credentials -&gt; OAuth client ID. Application type is a Web Application and the Redirect URI will need to point to oauth.php in your web root i.e. .

To register for Microsoft SSO goto  and Azure Active Director -&gt; App Registrations. Make sure the redirect URI points to oauth.php in your web root i.e.

Contributions more than welcome!

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 90% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1417730?v=4)[Andrew Rose](/maintainers/andrew-rose)[@andrew-rose](https://github.com/andrew-rose)

---

Top Contributors

[![AndrewRose](https://avatars.githubusercontent.com/u/197632?v=4)](https://github.com/AndrewRose "AndrewRose (9 commits)")[![motyar](https://avatars.githubusercontent.com/u/517371?v=4)](https://github.com/motyar "motyar (1 commits)")

### Embed Badge

![Health badge](/badges/andrew-rose-oauthphp/health.svg)

```
[![Health](https://phpackages.com/badges/andrew-rose-oauthphp/health.svg)](https://phpackages.com/packages/andrew-rose-oauthphp)
```

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.3M17](/packages/kartik-v-yii2-password)[vitalybaev/laravel5-dkim

Laravel 5/6 package for signing outgoing messages with DKIM.

3163.1k](/packages/vitalybaev-laravel5-dkim)

PHPackages © 2026

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