informeren/oauth2-mobilepay 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

informeren/oauth2-mobilepay

Composer 安装命令:

composer require informeren/oauth2-mobilepay

包简介

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

README 文档

README

Build Status

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

This package is compliant with PSR-1, PSR-4 and PSR-12. If you notice compliance oversights, please send a patch via pull request.

Requirements

The following versions of PHP are supported.

  • PHP 7.3
  • PHP 7.4

Install

Use composer to install the package:

$ composer require informeren/oauth2-mobilepay

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

$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

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

Refresh access token

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

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

Tests can be run with:

$ composer test

Static analysis can be run with:

$ composer analyze

Style checks can be run with:

$ composer check

Documentation

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 475
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固