jpskill.com
🛠️ 開発・MCP コミュニティ

oracle-idcs-better-auth-setup

Oracle IDCS/OCI IAM環境でBetter Authを構築し、OIDCコールバックURLや信頼できるオリジン設定、FastifyとNext.js間での認証モデル共有などを円滑に進めるための、認証基盤構築を支援するSkill。

📜 元の英語説明(参考)

Use when setting up Better Auth with Oracle IDCS/OCI IAM, configuring OIDC callback URLs, trusted origins, provider bootstrap order, or sharing an auth model between Fastify and Next.js. Entry point for the full auth foundation — routes to bridge or provisioning skills when narrowed. Keywords: Oracle IDCS, OCI IAM, Better Auth, OIDC, Fastify auth, Next.js auth, callback URL, trusted origins, provider bootstrap.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Oracle IDCS/OCI IAM環境でBetter Authを構築し、OIDCコールバックURLや信頼できるオリジン設定、FastifyとNext.js間での認証モデル共有などを円滑に進めるための、認証基盤構築を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o oracle-idcs-better-auth-setup.zip https://jpskill.com/download/9173.zip && unzip -o oracle-idcs-better-auth-setup.zip && rm oracle-idcs-better-auth-setup.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9173.zip -OutFile "$d\oracle-idcs-better-auth-setup.zip"; Expand-Archive "$d\oracle-idcs-better-auth-setup.zip" -DestinationPath $d -Force; ri "$d\oracle-idcs-better-auth-setup.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して oracle-idcs-better-auth-setup.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → oracle-idcs-better-auth-setup フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Oracle IDCS + Better Auth セットアップ

完全な認証基盤への入門スキル:Oracleアダプター、OIDC構成、信頼できるオリジン、コールバックURL、プロバイダーのブートストラップ、およびアプリ間の一貫性。

これはルーターであり、詳細な実装ガイドではありません。問題がどこにあるかを診断するために使用し、適切なスキルに引き継いでください。

絶対にしないこと

  • フルスタックのセットアップガイダンスとFastifyブリッジの内部構造や組織のプロビジョニングの内部構造を混在させないでください。各スキルがそれぞれのドメインを所有します。
  • コールドスタート時にDBからプロバイダーをブートストラップしないでください。最初に環境変数からシードし、オペレーターの可視性のためにOracleプロバイダーテーブルに反映します。
  • 既存のオペレーター管理の行を上書きするプロバイダーのブートストラップを作成しないでください。べき等な create-if-missing のみを使用します。
  • IDCSスコープから urn:opc:idm:__myscopes__ を省略しないでください。省略すると、トークンから groups クレームが暗黙的に削除され、ダウンストリームのすべてのロールベースのロジックが中断されます。
  • OAuthの成功がローカルセッションの成功を意味すると信頼しないでください。間違ったコールバックURLはOAuthの成功に続き、ローカルセッションの失敗が発生し、誤解を招く失敗モードになります。

意思決定ツリー:どのスキルがこれを所有しているか?

問題は認証基盤(セットアップ、構成、ブートストラップ)にありますか?
├── はい → このスキルにとどまる

問題はFastifyでのランタイムリクエスト/セッションの処理にありますか?
├── はい → 次のスキルに切り替える: fastify-better-auth-bridge

問題はログイン後のメンバーシップ、グループ、または org_members の書き込みにありますか?
├── はい → 次のスキルに切り替える: oracle-idcs-org-provisioning

ユーザーがバグがどのレイヤーにあるか確信が持てませんか?
├── はい → このスキルを使用して、最初にセットアップチェックリストを確認する

基盤の検証順序

セットアップの問題を診断するときは、次の正確な順序で検証してください(後の項目は前の項目に依存します)。

  1. OracleアダプターとBetter AuthテーブルがDBに存在すること
  2. IDCSコンフィデンシャルアプリケーションが正しいコールバックURLを使用していること
  3. スコープに openid,email,profile,urn:opc:idm:__myscopes__ が含まれていること
  4. 信頼できるオリジンとCookie属性がデプロイされたアプリのトポロジーと一致すること
  5. 環境変数の構成で、DB管理のプロバイダー設定が編集される前に認証をコールドスタートできること
  6. 環境変数からDBへのブートストラップがべき等であり、既存のプロバイダー行を上書きしないこと

自明ではないセットアップルール

環境変数優先のブートストラップ: プロバイダー行がDBに存在していなくても、認証は環境変数のみから機能する必要があります。プロバイダー行は、コールドスタートのためではなく、オペレーターの可視性のためのものです。これを逆にすると、DBシードが実行される前に、最初のデプロイで認証が中断されます。

共有ビルディングブロック: Oracleアダプター、Cookieルール、IDCSプロファイルマッパー、およびセッションフックの動作は、FastifyアプリとNext.jsアプリで共有する必要があります。これら2つを分岐させると、追跡が困難な微妙なトークン/セッションの不整合が発生します。

命名の安定性: コードベースがすでにIDCSと OCI_IAM_* 環境変数命名を使用している場合は、それを維持してください。命名スキームを混在させると(たとえば、ORACLE_* 変数を導入すると)、スクリプトが中断し、環境変数のマトリックスが混乱します。

コールバックURLの失敗モード: 間違ったコールバックURLは、OAuthフローが成功したように見えます(IDCSがリダイレクトバックします)が、ローカルセッションの作成は直後に失敗します。ログインが「完了」したように見えるが、ユーザーが認証されていない場合は、他のものをデバッグする前にこれを確認してください。

よくある落とし穴

症状 考えられる原因
トークンに groups クレームがない urn:opc:idm:__myscopes__ スコープが欠落している
OAuthは成功するが、セッションは失敗する IDCSアプリ構成のコールバックURLが間違っている
デプロイ時にプロバイダー行が消去される ブートストラップロジックがべき等ではない
認証はローカルでは機能するが、本番環境では失敗する 信頼できるオリジンに本番環境ドメインがない

スクリプト

# 必要なすべての環境変数が設定されていることを検証する
node scripts/validate-idcs-env.js

# 現在の状態ですべてのセットアップチェックリストを出力する
node scripts/print-auth-checklist.js

引数

  • $ARGUMENTS: オプションのセットアップの焦点
    • 例: /oracle-idcs-better-auth-setup callback-url
    • 例: /oracle-idcs-better-auth-setup trusted-origins
    • 空の場合: 共有認証セットアップフロー全体を監査します
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Oracle IDCS + Better Auth Setup

Entry skill for the full auth foundation: Oracle adapter, OIDC config, trusted origins, callback URLs, provider bootstrap, and cross-app consistency.

This is a router, not a deep implementation guide. Use it to diagnose where the problem lives, then hand off to the right skill.

NEVER

  • Never mix full-stack setup guidance with Fastify bridge internals or org provisioning internals — each skill owns its domain.
  • Never bootstrap providers from DB on cold-start — seed from env first, then reflect into Oracle provider tables for operator visibility.
  • Never write provider bootstrap that overwrites existing operator-managed rows — idempotent create-if-missing only.
  • Never skip urn:opc:idm:__myscopes__ from IDCS scopes — its absence silently removes the groups claim from tokens, breaking all role-based logic downstream.
  • Never trust that OAuth success means local session success — wrong callback URL produces OAuth success followed by local session failure, a misleading failure mode.

Decision Tree: Which Skill Owns This?

Is the problem in the auth foundation (setup, config, bootstrap)?
├── Yes → Stay in this skill

Is the problem in runtime request/session handling in Fastify?
├── Yes → Switch to: fastify-better-auth-bridge

Is the problem in post-login membership, groups, or org_members writes?
├── Yes → Switch to: oracle-idcs-org-provisioning

Is the user unsure which layer the bug is in?
├── Yes → Use this skill to verify setup checklist first

Foundation Verification Order

When diagnosing setup issues, verify in this exact order (later items depend on earlier ones):

  1. Oracle adapter and Better Auth tables exist in DB
  2. IDCS confidential application uses the correct callback URL
  3. Scopes include openid,email,profile,urn:opc:idm:__myscopes__
  4. Trusted origins and cookie attributes match the deployed app topology
  5. Env config can cold-start auth before DB-managed provider settings are edited
  6. Env-to-DB bootstrap is idempotent and never overwrites existing provider rows

Non-Obvious Setup Rules

Env-first bootstrap: Auth must be functional from env vars alone before provider rows exist in DB. Provider rows are for operator visibility, not for cold-start. If you invert this, auth breaks on first deploy before any DB seed runs.

Shared building blocks: Oracle adapter, cookie rules, IDCS profile mapper, and session hook behavior must be shared across Fastify and Next.js apps. Diverging these two causes subtle token/session inconsistencies that are hard to trace.

Naming stability: When the codebase already uses IDCS and OCI_IAM_* env var naming, keep it. Mixing naming schemes (e.g., introducing ORACLE_* vars) breaks scripts and makes the env matrix confusing.

Callback URL failure mode: A wrong callback URL looks like OAuth flow succeeds (IDCS redirects back) but local session creation fails immediately after. Check this before debugging anything else if login appears to "complete" but the user isn't authenticated.

Common Gotchas

Symptom Likely Cause
No groups claim in token Missing urn:opc:idm:__myscopes__ scope
OAuth succeeds, session fails Wrong callback URL in IDCS app config
Provider rows wiped on deploy Bootstrap logic not idempotent
Auth works locally, fails in prod Trusted origins missing prod domain

Scripts

# Validate all required env vars are set
node scripts/validate-idcs-env.js

# Print full setup checklist with current state
node scripts/print-auth-checklist.js

Arguments

  • $ARGUMENTS: Optional setup focus
    • Example: /oracle-idcs-better-auth-setup callback-url
    • Example: /oracle-idcs-better-auth-setup trusted-origins
    • If empty: audit the full shared auth setup flow