承接 vulpes/access-token 相关项目开发

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

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

vulpes/access-token

最新稳定版本:v2.0.0

Composer 安装命令:

composer require vulpes/access-token

包简介

Access token utility.

README 文档

README

Generate token with GoogleAccessToken for your Google client

GOOGLE_APPLICATION_CREDENTIALS: "/app/your-service-account.json"
<?php

require 'vendor/autoload.php';

$googleServiceAccount = new Token\GoogleAccessToken;
$googleServiceAccount->setScopes(...scopes: 'https://www.googleapis.com/auth/pubsub');

$googleServiceAccount->generateToken();

Generate a token and decode an access token on the other side

<?php

require 'vendor/autoload.php';

$serviceAccount = new Token\AccessToken(
    payload: [
        'iss' => 'it\'s me',
        'sub' => 'my-id'
    ]
);

// you can set your own keys in the Token\AccessToken constructor, this is (optional)
$serviceAccount->generateKeys();

// you can save your newly generated public key (optional), and your private too (and it's ID)
$publicKey = $serviceAccount->getPublicKey();

// your token to pass for example via Bearer
$token = $serviceAccount->generateToken();

// On the other side, you can use Your public key to decode the token
$otherServiceAccount = new Token\AccessToken(public_key: $publicKey);

// And here you get you're payload
$payload = $otherServiceAccount->decodeToken($token);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-24