承接 lade-devs/socialite-apple-jwt-generator 相关项目开发

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

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

lade-devs/socialite-apple-jwt-generator

Composer 安装命令:

composer require lade-devs/socialite-apple-jwt-generator

包简介

Laravel Socialite Apple Login Helper to generate and manage Client Secret

README 文档

README

Latest Stable Version Total Downloads Tests License

Laravel Socialite helper to generate and auto-refresh the Apple Sign-In client secret — a signed ES256 JWT required by Apple's OAuth flow.

Apple enforces a maximum 6-month (180-day) expiry on client secrets.
This package handles generation, storage in .env, and scheduled automatic refresh.

Requirements

Version
PHP ^8.3
Laravel ^12.0
lcobucci/jwt ^5.6

Installation

composer require lade-devs/socialite-apple-jwt-generator

Laravel's package auto-discovery registers the service provider automatically.

Apple Developer Setup

You will need the following from the Apple Developer Portal:

  1. Team ID – found under Membership.
  2. Key ID – found under Certificates, Identifiers & Profiles → Keys.
  3. Client ID – your Services ID identifier (e.g. com.example.signin).
  4. Auth Key file (.p8) – downloaded when you create the key.
    Place it inside storage/app/ and note the filename, e.g. AuthKey_ABCDEF1234.p8.
  5. Redirect URI – the fully-qualified HTTPS callback URL registered in your Services ID.

Configuration

1. Run the interactive setup

php artisan socialite:apple

The command prompts for all five values above plus a refresh interval (default 180 days), generates the client secret JWT, and writes everything to .env.

2. Add to config/services.php

This ensures values survive php artisan config:cache in production:

'apple' => [
    'client_id'                   => env('APPLE_CLIENT_ID'),
    'client_secret'               => env('APPLE_CLIENT_SECRET'),
    'redirect'                    => env('APPLE_REDIRECT_URI'),
    'key_id'                      => env('APPLE_KEY_ID'),
    'team_id'                     => env('APPLE_TEAM_ID'),
    'auth_key'                    => env('APPLE_AUTH_KEY'),
    'client_secret_updated_at'    => env('APPLE_CLIENT_SECRET_UPDATED_AT'),
    'refresh_token_interval_days' => env('APPLE_REFRESH_TOKEN_INTERVAL_DAYS', 180),
],

Automatic Secret Refresh

The package registers a scheduled task that checks every minute whether the secret is due for renewal based on APPLE_REFRESH_TOKEN_INTERVAL_DAYS and APPLE_CLIENT_SECRET_UPDATED_AT.

Make sure Laravel's task scheduler is running:

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Manual refresh

php artisan socialite:apple --refresh

Environment Variables

Variable Description
APPLE_CLIENT_ID Your Services ID
APPLE_CLIENT_SECRET Generated JWT (managed by this package)
APPLE_REDIRECT_URI OAuth callback URL
APPLE_KEY_ID Key ID from the developer portal
APPLE_TEAM_ID Team ID from the developer portal
APPLE_AUTH_KEY Filename of the .p8 key in storage/app/
APPLE_CLIENT_SECRET_UPDATED_AT Unix timestamp of last generation (auto-managed)
APPLE_REFRESH_TOKEN_INTERVAL_DAYS Days between refreshes (1–180, default 180)

Running Tests

composer install
vendor/bin/phpunit

Changelog

See CHANGELOG.md.

License

MIT © LadeDevs

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固