承接 d4h/pkce 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

d4h/pkce

最新稳定版本:1.0.0

Composer 安装命令:

composer require d4h/pkce

包简介

PHP implementation of RFC7636 (Proof Key for Code Exchange by OAuth Public Clients)

README 文档

README

Latest Stable Version Total Downloads License

Implementation of RFC 7636

Usage

use function OAuth\PKCE\generatePair; use function OAuth\PKCE\generateChallenge; use function OAuth\PKCE\verifyChallenge; // Generate a pair $pair = generatePair(128); // Store this in session $codeVerifier = $pair->getVerifier(); // Pass this onto the /authorize endpoint of the OAuth server $codeChallenge = $pair->getChallenge(); $queryString = http_build_query([ 'redirect_uri' => 'https://example.com', 'response_type' => 'code', 'client_id' => 'xxxxx', 'code_challenge_method' => 'S256', 'code_challenge' => $codeChallenge, 'state' => $state, ]); // Use the verifier to exchange the auth code for a token $params = [ 'client_id' => 'xxxxx', 'client_secret' => 'xxxxx', // If you have one 'code' => $code, // Received on your redirect uri 'code_verifier' => $codeVerifier, // Fetched from the session ]; // On the server side: if (! verifyChallenge($codeVerifier, $codeChallenge)) { // Throw exception because the given code, code_verifier and code_challenge are not matching. } // Or if you've saved the code with the code_challenge as a key: // Query for a stored token with the given code and generated code_challenge $codeChallenge = generateChallenge($codeVerifier);

Contributing

Feel free to make a pull request. Give a concise but complete description of what is supposed to be added/changed/removed/fixed.

Testing

To test your code before pushing, run the unit test suite.

vendor/bin/phpunit

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固