定制 killmails/oauth2-eve 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

killmails/oauth2-eve

Composer 安装命令:

composer require killmails/oauth2-eve

包简介

EVE Online OAuth 2.0 Client Provider for The PHP League OAuth2-Client

README 文档

README

GitHub Source GitHub Release GitHub License GitHub Actions Workflow Status Packagist Downloads

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

Installation

To install, use composer:

composer require killmails/oauth2-eve:^2.0

Usage

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

Authorization Code Flow

use Killmails\OAuth2\Client\Provider\EveOnline;

$sso = new EveOnline([
    'clientId' => '{eveonline-client-id}',
    'clientSecret' => '{eveonline-client-secret}',
    'redirectUri' => 'https://example.com/callback-url',
]);

if (empty($_GET['code'])) {
    $url = $sso->getAuthorizationUrl();
    $_SESSION['state'] = $sso->getState();

    header('Location: '.$authUrl);
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['state'])) {
    unset($_SESSION['state']);
} else {
    $token = $sso->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    $user = $sso->getResourceOwner($token);

    printf('Hello, %s (%d)', $user->getName(), $user->getId());
}

Managing Scopes

When creating your EVE Online authorization URL, you can specify the state and scopes your application may authorize.

$options = [
    'scope' => ['esi-killmails.read_killmails.v1']
];

$url = $sso->getAuthorizationUrl($options);

// ...

If neither are defined, the provider will utilize internal defaults.

Testing

composer test

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-02-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固