PHPackages                             twetech/oauth2-ninjaone - 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. twetech/oauth2-ninjaone

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

twetech/oauth2-ninjaone
=======================

1.0(1y ago)211PHP

Since Aug 23Pushed 1y agoCompare

[ Source](https://github.com/twetech/oauth2-ninjaone)[ Packagist](https://packagist.org/packages/twetech/oauth2-ninjaone)[ RSS](/packages/twetech-oauth2-ninjaone/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

This package provides NinjaOne OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

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

[](#installation)

To install, use composer:

```
composer require twetech/oauth2-ninjaone

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new League\OAuth2\Client\Provider\Ninjaone([
    'clientId'          => '{ninjaone-client-id}',
    'clientSecret'      => '{ninjaone-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url'
]);

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

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl();
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: '.$authUrl);
    exit;

// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {

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

} else {

    // Try to get an access token (using the authorization code grant)
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    // Use this to interact with an API on the users behalf
    echo $token->getToken();
}
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

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

Unknown

Total

1

Last Release

678d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/24534046?v=4)[Andrew Malsbury](/maintainers/o-psi)[@o-psi](https://github.com/o-psi)

---

Top Contributors

[![o-psi](https://avatars.githubusercontent.com/u/24534046?v=4)](https://github.com/o-psi "o-psi (7 commits)")

---

Tags

ninjaoneninjaone-apininjarmmninjarmm-apioauthoauth2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/twetech-oauth2-ninjaone/health.svg)

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

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

25310.7M83](/packages/thenetworg-oauth2-azure)[league/oauth2-google

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

42223.4M176](/packages/league-oauth2-google)[stevenmaguire/oauth2-keycloak

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

2306.4M45](/packages/stevenmaguire-oauth2-keycloak)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[patrickbussmann/oauth2-apple

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

1152.8M12](/packages/patrickbussmann-oauth2-apple)

PHPackages © 2026

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