slepic/apple-sign-in-client-secret-generator

用于生成“客户端密钥”的Sign In with Apple的PHP包

0.1.2 2022-03-08 08:32 UTC

This package is auto-updated.

Last update: 2024-09-08 14:18:15 UTC


README

描述

此包提供了一个类,该类使用ES256 JWT算法从您的私钥生成令牌。有关更多信息,请参阅有用的链接

要求

PHP >= 8.0

安装

安装composer包

composer require slepic/apple-sign-in-client-secret-generator

示例用法

<?php

use Slepic\AppleSignInClientSecretGenerator\AppleSignInClientSecretGenerator;

$clientId = 'com.example.TESTAPP';
$teamId   = 'FOO123BAR456';
$keyId    = '654RAB321OOF';
$certPath = __DIR__ . '/certificate.p8';
$privateKey = \file_get_contents($certPath);

$clientSecret = new AppleSignInClientSecretGenerator();

echo $clientSecret->generate($clientId, $teamId, $keyId, $privateKey);

版权

该项目最初是从以下位置分叉的: kissdigital-com/apple-sign-in-client-secret-generator

在从kissdigital.com解决方案迁移时,您必须

  • 替换类名
  • 将您的凭据传递给generate()方法而不是类构造函数
  • 自行从文件中提取私钥,并且只将其内容传递给generate()方法