Skip to content

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

Google Workspace

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

Google Workspace(旧 G Suite)アカウントを Cloudflare Access と連携できます。汎用の Google 認証 の手順と異なり、次の手順では Google Workspace アカウントからグループ所属情報を取得できます。

連携後、ユーザーは Google Workspace の認証情報でログインし、Cloudflare Access で保護されたリソースに到達したり、デバイスを Cloudflare Gateway に登録したりできます。

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

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

1. Google Workspace を設定する

  1. Google Cloud Platform の コンソール にログインします。Google Workspace のコンソールとは別です。

  2. Google Workspace API を有効にするには、Google Cloud プロジェクトが必要です。まだない場合は、IAM & Admin > Create Project を開きます。プロジェクト名を入力し、Create を選択します。

  3. APIs & Services を開き、Enable APIs and Services を選択します。API Library が読み込まれます。

  4. API Library で admin を検索し、Admin SDK API を選択します。

  5. Admin SDK API を Enable します。

  6. APIs & Services ページに戻り、Credentials を開きます。

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

    Google Cloud Platform コンソールで Consent Screen を設定する場所
  8. Consent Screen を設定するには、次の手順を実行します。

    1. Get Started を選択します。
    2. App nameUser support email を入力します。
    3. Audience Type で Internal を選びます。この Audience Type は認可リクエストを Google Workspace 内のユーザーに限定し、通常の Gmail アドレスのユーザーをブロックします。
    4. Contact Information を入力します。Google Cloud Platform では、アカウント内のメールアドレスが必要です。
    5. Google のユーザーデータポリシーに同意し、Continue を選択します。
    6. Create を選択します。
  9. OAuth の概要ページが読み込まれます。Create OAuth Client を選択します。

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

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

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

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

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

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

  14. Google Admin consoleSecurity > Access and data control > API controls を開きます。

  15. API ControlsSettings を選択します。

  16. Internal apps を選択し、Trust internal apps のチェックボックスをオンにして有効にします。Trust internal apps はデフォルトで無効で、Cloudflare Access を正しく動作させるには有効にする必要があります。

    Google Cloud Platform コンソールで内部アプリを信頼する場所

2. Cloudflare One に Google Workspace を追加する

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

  2. Add new identity provider を選択し、Google Workspace を選択します。

  3. 先ほど生成した Client ID(Cloudflare ダッシュボードでは App ID)と Client Secret を入力します。あわせて、Google Workspace アカウントのドメインも入力します。

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

  5. (任意)Optional configurations で、ユーザーの ID に追加する カスタム OIDC クレーム を入力します。

  6. Save を選択します。セットアップを完了するには、生成されたリンクを開く必要があります。Google Workspace の管理者でない場合は、管理者にリンクを共有します。

  7. 生成されたリンクでは、Google 管理者アカウントへのログインと、Cloudflare Access にグループ情報の閲覧を許可することが求められます。権限を許可すると、Cloudflare Access の成功ページが表示されます。

接続を確認するには、Integrations > Identity providers を開き、Google Workspace の横の Test を選択します。ユーザー ID とグループ所属が返されます。

API 設定の例

{
	"config": {
		"client_id": "<your client id>",
		"client_secret": "<your client secret>",
		"apps_domain": "mycompany.com"
	},
	"type": "google-apps",
	"name": "my example idp"
}

トラブルシューティング

Error 401: deleted_client

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

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

役に立ちましたか?