PHPackages                             javis/password-grant-client - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. javis/password-grant-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

javis/password-grant-client
===========================

A PHP library to easily OAuth2 to your APIs using the Password Grant

v1.1.3(5y ago)022MITPHPPHP &gt;=5.5.9

Since May 22Pushed 5y agoCompare

[ Source](https://github.com/javis/password-grant-client)[ Packagist](https://packagist.org/packages/javis/password-grant-client)[ RSS](/packages/javis-password-grant-client/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (6)Used By (0)

PHP Oauth2 Password Grant Client
================================

[](#php-oauth2-password-grant-client)

[![Build Status](https://camo.githubusercontent.com/b31563f96de413ec317afdb7b045b2f9d01369863a4d257fc16af68c85764473/68747470733a2f2f7472617669732d63692e6f72672f6a617669732f70617373776f72642d6772616e742d636c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/javis/password-grant-client)[![Latest Stable Version](https://camo.githubusercontent.com/a53d8316319bfc5f15de7dd0e69fa52655cda1cbbaff85c5db1d90b58205e961/68747470733a2f2f706f7365722e707567782e6f72672f6a617669732f70617373776f72642d6772616e742d636c69656e742f762f737461626c652e737667)](https://packagist.org/packages/javis/password-grant-client)[![Total Downloads](https://camo.githubusercontent.com/12ece802eaf4036d05395ab1b4f6ac4da736ea3c39ad53eccb848bea2cb44870/68747470733a2f2f706f7365722e707567782e6f72672f6a617669732f70617373776f72642d6772616e742d636c69656e742f646f776e6c6f6164732e737667)](https://packagist.org/packages/javis/password-grant-client)[![Quality Score](https://camo.githubusercontent.com/260a268bf37ae600678c16b5074e189c288661deef7eda9e3ea12b33fe53387d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6a617669732f70617373776f72642d6772616e742d636c69656e742e737667)](https://scrutinizer-ci.com/g/javis/password-grant-client)[![License](https://camo.githubusercontent.com/af286a41d2f3e44f4d935994fb511dd358885b1d8dbc2aa84dfa224c9842ce21/68747470733a2f2f706f7365722e707567782e6f72672f6a617669732f70617373776f72642d6772616e742d636c69656e742f6c6963656e73652e737667)](https://packagist.org/packages/javis/password-grant-client)

A PHP library to easily authorize [OAuth 2.0](http://tools.ietf.org/wg/oauth/draft-ietf-oauth-v2/) APIs using the Password Grant. This is a wrapper of the amazing [The League of Extraordinary Packages OAuth2 Client](https://github.com/thephpleague/oauth2-client), but it automates the process of storing the token in session and refreshing it when necessary

Requirements
------------

[](#requirements)

- PHP &gt;= 5.5

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

[](#installation)

```
composer require javis/password-grant-client

```

Usage
-----

[](#usage)

### Configuring the client

[](#configuring-the-client)

Create a Client Provider with the configuration to the endpoints and then provide the instance to the OAuth2 Client.

```
$provider = new \League\OAuth2\Client\Provider\GenericProvider([
    'clientId'                => 'demoapp',    // The client ID assigned to you by the provider
    'clientSecret'            => 'demopass',   // The client password assigned to you by the provider
    'urlAccessToken'          => 'http://brentertainment.com/oauth2/lockdin/token'
]);

$client = new \Javis\OAuth2\PasswordGrantClient($provider);
```

### Requesting an access token

[](#requesting-an-access-token)

When requesting the token, the Client will automatically check for if it was already stored in Session or if it needs to refresh it, and perform all required operations before returning it.

```
$return = $client->getAccessToken('username', 'password');
echo $token->getToken();
```

### Forgetting stored token

[](#forgetting-stored-token)

```
$client->forgetToken();
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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 ~133 days

Total

5

Last Release

2013d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6478000dc7075c623c3d4d1ba1ead3a12d4cedefc21fca8782edda556a52a7a0?d=identicon)[javis](/maintainers/javis)

---

Top Contributors

[![javis](https://avatars.githubusercontent.com/u/951888?v=4)](https://github.com/javis "javis (1 commits)")

---

Tags

httpapiclientpasswordoauth2grant

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/javis-password-grant-client/health.svg)

```
[![Health](https://phpackages.com/badges/javis-password-grant-client/health.svg)](https://phpackages.com/packages/javis-password-grant-client)
```

###  Alternatives

[vinelab/http

An http library developed for the laravel framework. aliases itself as HttpClient

59300.2k11](/packages/vinelab-http)[basecrm/basecrm-php

BaseCRM Official API V2 library client for PHP

221.0M](/packages/basecrm-basecrm-php)[jsor/hal-client

A lightweight client for consuming and manipulating Hypertext Application Language (HAL) resources.

2425.9k1](/packages/jsor-hal-client)[meteocontrol/vcom-api-client

HTTP Client for meteocontrol's VCOM API - The VCOM API enables you to directly access your data on the meteocontrol platform.

175.7k1](/packages/meteocontrol-vcom-api-client)[laragear/api-manager

Manage multiple REST servers to make requests in few lines and fluently.

161.8k](/packages/laragear-api-manager)

PHPackages © 2026

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