cp2025 計算機程式

  • Home
    • SMap
    • reveal
    • blog
  • About
    • cs101
    • Computer
      • llama
      • nginx
    • AI
      • QandA
      • Teams
    • Homework
  • Topics
    • Git
      • Git_ex1
      • Git_ex2
    • Python
      • SE
      • CL
      • Loops
      • Recursion
      • SA
      • SST
      • Maze
      • Collect
      • GT
      • Python_ex1
    • Javascript
      • HTML and CSS
    • Project
      • Waitress
      • API
  • Brython
    • Brython_ex
    • Robot_ex
  • Ref
    • Reeborg
      • ex1
      • Otto_ninja
    • tkinter
    • Pyodide
    • Pyodide_ex
    • Pyodide2
      • robot.py
      • Example2
    • Pyodide3
      • png_files
      • Harvest
Waitress << Previous Next >> Brython

API

以下是「建立 Google Cloud Platform 專案並啟用 Admin SDK API」的詳細操作步驟,適用於管理 Google Workspace 的自動化應用:

一、建立 Google Cloud Platform (GCP) 專案

1. 登入 Google Cloud Console
   前往 [Google Cloud Console](https://console.cloud.google.com)。

2. 建立新專案
   - 點選左上角的「專案選單」下拉按鈕(通常會顯示你目前的專案名稱)。
   - 在彈出的專案視窗中,點選「新建專案」。
   - 輸入專案名稱(如:workspace-account-automation)。
   - 選擇對應的組織與資料夾(如有需要)。
   - 點選「建立」。

3. 切換到新專案
   - 專案建立完成後,點選右上角的「通知」可快速切換到新專案,或再次於專案選單中切換至新專案。

二、啟用 Admin SDK API and Gmail API

1. 進入 API 管理頁面
   - 確認你當前專案已切換至剛建立的專案。
   - 在左側導覽列,選擇「API 與服務」→「程式庫」。

2. 搜尋並啟用 Admin SDK
   - 在搜尋框輸入 `Admin SDK`。
   - 點選搜尋結果中的「Admin SDK」。
   - 點選「啟用」。

  • 前往 Google Cloud Console:
    https://console.cloud.google.com/apis/library

  • 搜尋並啟用對應 API,例如:

    • Google Drive API

    • Gmail API

    • Google Sheets API 等

三、(進階)建立並下載 Service Account 金鑰

https://console.cloud.google.com/iam-admin/serviceaccounts 

建立新的服務帳戶並啟用 Domain-wide Delegation

步驟:

建立一個新的 Service Account(在建立流程中會有「進階設定」)

詳細步驟如下:

1. 前往 [Google Cloud Console – Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts)
2. 點選【建立服務帳戶】
3. 輸入服務帳戶名稱、ID、描述,點【建立並繼續】
4. 權限頁面可以直接點【繼續】
5. 第三步是「授予使用者訪問權限」:忽略它 ➝ 點【完成】
6. 建立完成後,回到該服務帳戶的詳細資料頁面

啟用 Domain-wide Delegation:

1. 點你剛建立的服務帳戶名稱
2. 點選頁面上方的【Domain-wide Delegation】分頁
3. 按下【啟用網域範圍代理】按鈕
4. 填寫「產品名稱」(任意填即可,如:Workspace Bot)
5. 點【儲存】

完成後你會看到:

* 一個 Client ID`(要貼去 Workspace 管理控制台使用)
* 「View Google Workspace Admin Console」按鈕

接著在 Workspace Admin Console 授權這個 Client ID

1. 登入 [admin.google.com](https://admin.google.com)(必須是超級管理員)
2. 前往:安全性 (Security) > Access and data control > API 控制權限 (API controls)> 網域範圍代理(Domain-wide delegation) > MANAGE DOMAIN WIDE DELEGATION
3. 點【新增】
4. 輸入你剛剛的 Client ID
5. 輸入你要授權的 OAuth scopes,例如:

https://www.googleapis.com/auth/admin.directory.user
https://www.googleapis.com/auth/admin.directory.group


Waitress << Previous Next >> Brython

Copyright © All rights reserved | This template is made with by Colorlib