GitHubをAuth0に接続する
GitHubアプリの権限: GitHubアプリはきめ細かな権限を使用するため、Token Vaultの構成時に権限をリクエストすることはできません。必要な権限は、GitHubの開発者設定でGitHubアプリを作成する際に設定してください。
1
GitHubのセットアップ
- GitHub開発者アカウントにサインアップします
- GitHub Developer Settings > GitHub Appsから新しいGitHubアプリをセットアップします
- GitHubアプリを構成する際は、以下の設定を使用します:
- Homepage URL:
https://YOUR_AUTH0_DOMAIN - Callback URL:
https://YOUR_AUTH0_DOMAIN/login/callback - Webhook Active: 無効
- Permissions: アプリに必要な権限を選択します
You can find the Auth0 domain in the Auth0 Dashboard.You can find this under Applications > [Your Application] > Settings > Basic Information > Domain.If you are using the custom domains feature, your Auth0 domain is the custom domain. You can find this under Branding > Custom Domains. - Homepage URL:
- Createを選択し、表示されるApp settingsページで新しいclient secretを生成します。
- Client IDとClient Secretを控えておきます
2
Auth0のセットアップ
- Auth0 Dashboardで、 [Authentication]>[Social] に移動します。[Create Connection] を選択し、次に [GitHub] を選択して、[続行] を選択します。
- [General] で、作成したGitHub OAuthアプリのClient IDとClient Secretを入力します。
- [用途] で、[Connected Accounts for Token Vault] をオンにします。これにより、この接続で外部APIのアクセストークンを取得し、安全に保存できるようになります。詳細については、Connected Accounts for Token Vaultを参照してください。
- [Create] を選択します。
- 保存後、[アプリケーション] タブに移動し、この接続を使用するアプリケーションを選択します。
アプリケーションでOrganizationsを使用している場合は、Connected Accounts フローを開始する前に、対象のOrganizationでユーザーを認証してください。その場合でも、Token VaultはGitHubの連携済みアカウントをユーザーのAuth0プロファイルに保存するため、Organizationの各メンバーがそれぞれ自分のGitHubアカウントを認可することになります。
このガイドでは、Auth0 で GitHub 接続をセットアップする手順を説明します。 このような接続を使用して、ユーザーに代わってアプリから第三者 API を呼び出す方法を一連の流れで示す例については、 ユーザーに代わって第三者 API を呼び出すクイックスタートをお読みください。
Token Vault の設定例
GitHub 接続で Token Vault を設定するには、アプリケーションで次のコードスニペットを使用します。- JavaScript
- Python
Next steps
- To learn how to configure applications to access Token Vault, read Configure Token Vault.
- If your application uses Organizations, authenticate the user with the target organization before initiating the Connected Accounts flow. Connected accounts remain linked to the individual user profile.
- To learn how to get an access token to make a tool call, complete the Call third-party APIs on user’s behalf Quickstart.