eaglexboy/ebay-oauth-php-client
Composer 安装命令:
composer require eaglexboy/ebay-oauth-php-client
包简介
eBay OAuth Client which helps in easy integration
README 文档
README
This is a port of the ebay-oauth-java-client
eBay OAuth Client Library (PHP)
eBay OAuth client library is a simple and easy-to-use library for integrating with eBay OAuth and designed to be used for OAuth 2.0 specification supported by eBay. There are multiple standard clients that can be used with eBay OAuth, such as OpenID Connect client. However, this library in addition to functioning as a simple eBay OAuth client, helps with additional features such as cached App tokens. There are also future enhancements planned to add id_token support, 'login with eBay' support etc.,
What is OAuth 2.0
OAuth 2.0 is the most widely used standard for authentication and authorization for API based access. The complete end to end documentation on how eBay OAuth functions is available at developer.ebay.com.
Supported Languages
This library is created as a PHP project and can be used as a dependency in a PHP based application
Installation
Install in your project by downloading the repo and extracting in your project or using composer
Composer
Add the library to your composer.json
{
"require": {
"eaglexboy/ebay-oauth-php-client": "^1.0"
}
}
or via command line
composer require eaglexboy/ebay-oauth-php-client
Getting Started
All interactions with this library can be performed using oauth2Api = new OAuth2Api();
Library Setup and getting started
- Ensure you have a config file in your source code of type YAML. Refer to ebay-config-sample.yaml.
- This file would hold all your application credentials such as AppId, DevId, and CertId. Refer to Creating eBay Developer Account for details on how to get these credentials.
- Once the file is created, call
CredentialUtil.loadFile(<your-config-location>);to load the credentials. - It is recommended to load the credentials during startup time (initialization) to prevent runtime delays.
- Once the credentials are loaded, call any operation on
OAuth2Api
Types of Tokens
There are mainly two types of tokens in usage.
Application Token
An application token contains an application identity which is generated using client_credentials grant type. These application tokens are useful for interaction with application specific APIs such as usage statistics etc.,
User Token
A user token (access token or refresh token) contains a user identity and the application's identity. This is usually generated using the authorization_code grant type or the refresh_token grant type.
Supported Grant Types for OAuth
All of the regular OAuth 2.0 specifications such as client_credentials, authorization_code, and refresh_token are all supported. Refer to eBay Developer Portal
Grant Type: Client Credentials
This grant type can be performed by simply using OAuth2Api.getApplicationToken(). Read more about this grant type at oauth-client-credentials-grant
Grant Type: Authorization Code
This grant type can be performed by a two step process. Call OAuth2Api.generateUserAuthorizationUrl() to get the Authorization URL to redirect the user to. Once the user authenticates and approves the consent, the callback need to be captured by the redirect URL setup by the app and then call OAuth2Api.exchangeCodeForAccessToken() to get the refresh and access tokens.
Read more about this grant type at oauth-authorization-code-grant and oauth-auth-code-grant-request
Grant Type: Refresh Token
This grant type can be performed by simply using OAuth2Api.getAccessToken(). Usually access tokens are short lived and if the access token is expired, the caller can use the refresh token to generate a new access token. Read more about it at Using a refresh token to update a user access token
Contribution
Contributions in terms of patches, features, or comments are always welcome. Refer to CONTRIBUTING for guidelines. Submit Github issues for any feature enhancements, bugs, or documentation problems as well as questions and comments.
Libraries used
- monolog
- symfony
Developers and Contributors
References
- https://developer.ebay.com/api-docs/static/oauth-token-types.html
- https://developer.ebay.com/api-docs/static/oauth-tokens.html
- https://developer.ebay.com/my/keys
License
Copyright (c) 2024 EC Systems Design.
Use of this source code is governed by a Apache-2.0 license that can be found in the LICENSE file or at https://opensource.org/licenses/Apache-2.0.
eaglexboy/ebay-oauth-php-client 适用场景与选型建议
eaglexboy/ebay-oauth-php-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.57k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 10 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「client」 「oauth」 「ebay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 eaglexboy/ebay-oauth-php-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 eaglexboy/ebay-oauth-php-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 eaglexboy/ebay-oauth-php-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
WeChat OAuth SDK
Ory-Hydra OAuth 2.0 Client Provider for The PHP League OAuth2-Client
Library for ORCID web services
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
An eBay SDK for PHP. Use the eBay API in your PHP projects.
Mock PSR-18 HTTP client
统计信息
- 总下载量: 1.57k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2024-10-05