PHPackages                             foxdeveloper/oauth2-gitea - 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. foxdeveloper/oauth2-gitea

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

foxdeveloper/oauth2-gitea
=========================

Gitea OAuth 2.0 Client provider for the PHP League OAuth2-Client

1.1.0(2y ago)11.3kMITPHPPHP &gt;=7.2

Since Feb 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/kvitrvn/oauth2-gitea)[ Packagist](https://packagist.org/packages/foxdeveloper/oauth2-gitea)[ RSS](/packages/foxdeveloper-oauth2-gitea/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

Gitea Provider for OAuth 2.0 Client
===================================

[](#gitea-provider-for-oauth-20-client)

[![SymfonyInsight](https://camo.githubusercontent.com/f5642a7cd1265c3e3933b42f848d86e1d7e038608d8e78a0a7b40ef2ce525a28/68747470733a2f2f696e73696768742e73796d666f6e792e636f6d2f70726f6a656374732f65333266383665362d323331322d346563312d616332312d6164623764326662366633332f6d696e692e737667)](https://camo.githubusercontent.com/f5642a7cd1265c3e3933b42f848d86e1d7e038608d8e78a0a7b40ef2ce525a28/68747470733a2f2f696e73696768742e73796d666f6e792e636f6d2f70726f6a656374732f65333266383665362d323331322d346563312d616332312d6164623764326662366633332f6d696e692e737667)

This package provides Gitea OAuth 2.0 support for the PHP League's OAuth 2.0 Client.

Installation
------------

[](#installation)

To install, use composer:

```
composer require foxdeveloper/oauth2-gitea
```

Usage
-----

[](#usage)

Usage is the same as The League's OAuth client, using `\FoxDeveloper\OAuth2\Client\Provider\Gitea` as the provider.

```
use FoxDeveloper\OAuth2\Client\Provider\Gitea;
use FoxDeveloper\OAuth2\Client\Provider\GiteaResourceOwner;

$provider = new Gitea([
    'clientId' => '{GITEA_CLIENT_ID}',
    'clientSecret' => '{GITEA_CLIENT_SECRET}',
    'redirectUri' => 'https://example.com/callback-url',
    'baseUrl' => '{GITEA_BASE_URL}',
]);

if (!isset($_GET['code'])) {

    $authUrl = $provider->getAuthorizationUrl();
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: '.$authUrl);
    exit();

} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {

    unset($_SESSION['oauth2state']);
    exit('Invalid state');

} else {

    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code'],
    ]);

    try {
        /** @var GiteaResourceOwner */
        $user = $provider->getResourceOwner($token);

        printf('Hello %s!', $user->getLogin());
    } catch (\Exception $e) {
        exit('Oh dear...');
    }

    echo $token->getToken();
}
```

Testing
-------

[](#testing)

```
./vendor/bin/phpunit
```

Credits
-------

[](#credits)

- [Benjamin Gaudé](https://github.com/foxdeveloper)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](./LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~475 days

Total

3

Last Release

966d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0709f521473eab9e49e0b336410713ad9d7c236e4e50084f5c19d945b4bf4f40?d=identicon)[Angzlar](/maintainers/Angzlar)

---

Top Contributors

[![kvitrvn](https://avatars.githubusercontent.com/u/52292364?v=4)](https://github.com/kvitrvn "kvitrvn (2 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationgitea

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/foxdeveloper-oauth2-gitea/health.svg)

```
[![Health](https://phpackages.com/badges/foxdeveloper-oauth2-gitea/health.svg)](https://phpackages.com/packages/foxdeveloper-oauth2-gitea)
```

###  Alternatives

[stevenmaguire/oauth2-keycloak

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

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[omines/oauth2-gitlab

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

36721.5k13](/packages/omines-oauth2-gitlab)

PHPackages © 2026

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