Tinyauth

Apple

Tinyauthから Apple ログインの設定

Apple ログイン(Sign in with Apple)を使用すると、ユーザーは Apple IDで tinyauthにログインできます。このガイドは Apple Developerでサービスを登録し、 tinyauthに連動する方法を説明します。


1. Apple 開発者設定

  1. Apple Developerにアクセスしてログインします。
  2. Certificates, Identifiers & Profilesに行きます。
  3. Identifiersから新しい App IDを登録します。 Sign in with Apple 機能を有効にします。
  4. Identifiersから新しい Services IDを登録します。
    • このサービスIDの Identifierclient_idになります。
    • Sign in with Appleを有効にして Configureをクリックしてください。
    • Domains and Subdomainsにドメインを追加します(例: auth.example.com).
    • Return URLsにコールバック URLを追加します。
      https://내_도메인.com/api/oauth/apple/callback
  5. Keysで新しいキーを作成し、 Sign in with Appleを有効にします。ダウンロードした .p8 ファイルと Key IDを安全に保管してください。
Note

Apple ログイン client_secret銀 JWT 形式で生成する必要があります。 Team ID、Key ID、および .p8 秘密鍵を使用して生成できます。詳細な方法は Apple 公式文書を参考にしてください。


2. Tinyauth 設定

Apple Developerで準備した資格証明 config.yamlに設定します。

# config.yaml
identity_providers:
  - id: apple
    type: apple
    enabled: true
    client_id: com.example.auth
    client_secret: ${APPLE_CLIENT_SECRET}
  • id:これはプロバイダの一意の識別子です。コールバック URLに使われます。
  • type: appleで指定します。
  • client_id: Apple Developerで登録したServices IDのIdentifierです。
  • client_secret:作成した JWT client secretです。
Caution

Appleは基本的に form_post 応答モードを使用します。 tinyauthはこれを自動的に処理するので、別途設定は不要です。 Appleは、ユーザーの名前を最初のログイン時にのみ提供し、IDトークンを介してユーザー情報を渡します。


tinyauthhttps://auth.example.comで運営する場合の全体設定例です。

# config.yaml
server:
  public_origin: https://auth.example.com

identity_providers:
  - id: apple
    type: apple
    enabled: true
    client_id: com.example.auth
    client_secret: eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9...

この場合 Apple DeveloperのReturn URLは、次のように設定する必要があります。

https://auth.example.com/api/oauth/apple/callback