PHPackages                             informeren/oauth2-mobilepay - 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. informeren/oauth2-mobilepay

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

informeren/oauth2-mobilepay
===========================

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

1.4.1(5y ago)24751[1 issues](https://github.com/informeren/oauth2-mobilepay/issues)MITPHPPHP ^7.3

Since May 28Pushed 5y ago1 watchersCompare

[ Source](https://github.com/informeren/oauth2-mobilepay)[ Packagist](https://packagist.org/packages/informeren/oauth2-mobilepay)[ Docs](https://github.com/informeren/oauth2-mobilepay)[ RSS](/packages/informeren-oauth2-mobilepay/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (6)Dependencies (7)Versions (8)Used By (0)

MobilePay Provider for OAuth 2.0 Client
=======================================

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

[![Build Status](https://camo.githubusercontent.com/120e4047aa3def1a1e9c31e8632c9cba6f794d8ec5c5fae1b73ea6f36b0e2d53/68747470733a2f2f7472617669732d63692e636f6d2f696e666f726d6572656e2f6f61757468322d6d6f62696c657061792e7376673f6272616e63683d646576656c6f70)](https://travis-ci.com/informeren/oauth2-mobilepay)

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

This package is compliant with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md) and [PSR-12](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-extended-coding-style-guide.md). If you notice compliance oversights, please send a patch via pull request.

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

[](#requirements)

The following versions of PHP are supported.

- PHP 7.3
- PHP 7.4

Install
-------

[](#install)

Use composer to install the package:

```
$ composer require informeren/oauth2-mobilepay
```

Usage
-----

[](#usage)

```
$provider = new MobilePay([
    'clientId' => 'examplecompany',
    'clientSecret' => 'yxWIQHKjeEXW1ayL7kV77mh9YInAZNmSjJGuOrG69GE',
    'discoveryUri' => 'https://www.example.com/discovery',
    'redirectUri' => 'https://www.example.com/redirect',
]);
```

The `clientId` and `clientSecret` values are provided by MobilePay. The rest of the values are provided by you.

### Create authorization URL

[](#create-authorization-url)

```
$url = $provider->getAuthorizationUrl([
    'scope' => ['openid', 'subscriptions', 'offline_access'],
    'response_type' => 'code id_token',
    'response_mode' => 'fragment',
    'code_verifier' => 'MVLkNAsW0uy5PnH3L3YwUzXqcPzMfNeKPIfD4K32MN4',
    'merchant_vat' => 'DK12345678',
]);
```

After the first request, you must use the same `code_verifier` value for all subsequent authorization requests, so store it in a safe place.

Open the resulting URL in a browser and accept the request. You will be redirected to the `redirectUri` and the authorization code will be available in the `code` URL parameter.

### Use authorization code to get access token

[](#use-authorization-code-to-get-access-token)

```
$token = $provider->getAccessToken('authorization_code', [
    'code' => 'gDnCpS1n2tUB4D428D2v4Daw77mKm66N2xekzEBSmKzeDspdUfrNnCTFWuZ2Ly9F',
    'code_verifier' => 'MVLkNAsW0uy5PnH3L3YwUzXqcPzMfNeKPIfD4K32MN4',
]);
```

### Refresh access token

[](#refresh-access-token)

```
$token = $provider->getAccessToken('refresh_token', [
    'refresh_token' => 'NDAwxVTnsE5KlHf4ganujXfG3EAAJkj0DquVuxXxZk6c4G1G0tIX8vQ40Jzxaq0j',
]);
```

### Command-line interface

[](#command-line-interface)

The package includes a simple command-line interface to the most common operations. Run it without arguments for usage instructions.

Use the following command to generate an authorization URL and open it in your default browser.

```
$ ./vendor/bin/mobilepay-auth authorize | xargs open
```

Testing
-------

[](#testing)

Tests can be run with:

```
$ composer test
```

Static analysis can be run with:

```
$ composer analyze
```

Style checks can be run with:

```
$ composer check
```

Documentation
-------------

[](#documentation)

- [MobilePay Subscriptions](https://developer.mobilepay.dk/subscriptions-main)
- [MobilePay OpenID Connect](https://developer.mobilepay.dk/developersupport/openid/)
- [MobilePay Subscriptions API](https://mobilepaydev.github.io/MobilePay-Subscriptions/index)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/informeren/oauth2-mobilepay/blob/master/LICENSE) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

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

Total

6

Last Release

2090d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d234da24cfaae9320b9aea5a02caacb1dd45bda6f7cca7dea0cf2be91d97d1a8?d=identicon)[wulff](/maintainers/wulff)

---

Top Contributors

[![wulff](https://avatars.githubusercontent.com/u/53680?v=4)](https://github.com/wulff "wulff (77 commits)")

---

Tags

mobilepayoauth2phpclientAuthenticationoauthoauth2authorizationmobilepay

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/informeren-oauth2-mobilepay/health.svg)

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

###  Alternatives

[league/oauth2-google

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

41721.2M119](/packages/league-oauth2-google)[patrickbussmann/oauth2-apple

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

1132.5M6](/packages/patrickbussmann-oauth2-apple)[cakedc/oauth2-cognito

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

18597.7k](/packages/cakedc-oauth2-cognito)

PHPackages © 2026

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