Skip to content

非公式本サイトは非公式の日本語ドキュメントであり、Cloudflare 公式サイトではありません。最新情報はdevelopers.cloudflare.comをご確認ください。

Google

最終更新 Markdown で表示Agent セットアップ

Google Workspace アカウントがなくても、Google 認証を Cloudflare Access に連携できます。この連携では、Google アカウントを持つユーザーなら誰でもログインできます(Access ポリシー がそのリソースへの到達を許可している場合)。Google Workspace の手順とは異なり、以下の手順では Google Workspace アカウントからグループ所属情報を取得できません。

Google を ID プロバイダーとして Cloudflare One に連携するために、Google Cloud Platform の利用者である必要はありません。IdP 連携の設定のために Google Cloud Platform を開くだけで十分です。

Google を ID プロバイダーとして設定する

  1. Google Cloud Platform の コンソール にログインします。新しいプロジェクトを作成し、名前を付けて Create を選択します。

  2. プロジェクトのホームページで APIs & Services を開き、サイドバーで Credentials を選択します。

  3. Configure Consent Screen を選択します。

    Google Cloud Platform コンソールで同意画面を設定する場所
  4. 同意画面を設定します。

    1. Get started を選択します。
    2. App nameUser support email を入力します。
    3. Audience Type は External を選びます。このアプリケーションは Google Workspace アカウント内で作成しないため、Gmail アドレスを持つユーザーなら誰でもログインできます。
    4. Contact Information を入力します。Google Cloud Platform では、アカウント内のメールアドレスが必要です。
    5. Google のユーザーデータポリシーに同意し、Continue を選択します。
    6. Create を選択します。
  5. OAuth の概要ページが開きます。OAuth の概要画面で Create OAuth client を選択します。

    Google Cloud Platform コンソールで OAuth クライアントを作成する場所
  6. Application typeWeb application を選び、OAuth Client ID に名前を付けます。

  7. Authorized JavaScript originsURIs に、チームドメインを入力します。

    https://<your-team-name>.cloudflareaccess.com

    チーム名は、Cloudflare ダッシュボードSettings > Team name and domain > Team name で確認できます。

  8. Authorized redirect URIsURIs に、次の URL を入力します。

    https://<your-team-name>.cloudflareaccess.com/cdn-cgi/access/callback
  9. OAuth クライアントを作成したら、作成したばかりの OAuth クライアントを選択します。Google は OAuth Client IDClient secret を表示します。Client secret はパスワードと同じ扱いなので、共有しないでください。OAuth Client IDClient secret の両方をコピーします。

  10. Cloudflare ダッシュボード で、Zero Trust > Integrations > Identity providers を開きます。

  11. Your identity providersAdd new identity provider を選択します。次のページで Google を選びます。

  12. 先ほど生成した Client ID(Cloudflare ダッシュボードでは App ID)と Client Secret を入力します。

  13. (任意)Proof of Key Exchange (PKCE) を有効にします。有効にすると、すべてのログイン試行で PKCE が実行されます。

  14. Save を選択します。

接続をテストする

接続をテストするには、Integrations > Identity providers を開き、Google の横にある Test を選択します。

API 設定の例

{
	"config": {
		"client_id": "<your client id>",
		"client_secret": "<your client secret>"
	},
	"type": "google",
	"name": "my example idp"
}

トラブルシューティング

Error 401: deleted_client

Google で OAuth クライアントを削除した(または OAuth クライアントの有効期限が切れた)場合、Error 401: deleted_client という認可エラーが表示されます。

この問題を解消するには、Google ガイドの手順 6 から 12 と、Google Workspace ガイドの手順 9 から 15 を完了します。

役に立ちましたか?