参考资料

申请

网址: https://console.cloud.google.com

Step: 新建 Project

  • Project Name: 随便填写

Step: 选择这个项目

进入这个项目的控制面板页面

Step: 进入 Credentials 页面

  • 路径:APIs & Services -> Credentials
  • 点击 Configure Consent Sreeen按钮,然后点击Get Started按钮,进入 Project configuration 页面

进入 Project configuration 页面

开始填写下面的配置项:

  • APP Information
    • APP Name: 填写你的项目的名称
    • User Support email: 选择群组邮箱
  • Audience: 选择 External
  • Contact Information: 谷歌通知你来使用的
  • Finish: 确保已经同意

Step: 配置 APP 基本信息

  • 路径:APIs & Services -> OAuth consent screen -> Branding
  • App logo: 请勿上传 App logo,这样可以免审核成为正式项目。 (推荐)
  • App domain:
    • Application home page: 网站主页地址,https://example.com
    • Application privacy polilcy link: 隐私页面地址
    • Application terms of serverce link: terms页面
  • Authorized domains: example.com

Step: 创建 Client

  • 路径:APIs & Services -> OAuth consent screen -> Clients
  • 点击 create client 按钮
  • 选择 Application Type: 选择 Web application
  • 填写 Name:
  • Authorized JavaScript origins
  • Authorized redirect URIs
  • 点击 Create按钮。会弹出一个OAuth client created弹窗,请妥善保管Client ID, Client secret,把这两个变量配置到代码仓库的环境变量中

Step: 选择 userinfo.email 和 userinfo.profile

  • 路径:APIs & Services -> OAuth consent screen -> Data Access
  • 点击Add or remove scopes按钮,在范围中添加 userinfo.email & userinfo.profile
  • 点击save按钮保存

Step: 配置测试用户

  • 路径:APIs & Services -> OAuth consent screen -> Audience
  • 点击 add users按钮

Step: 发布应用

测试完成之后,可以发布应用

  • 路径:APIs & Services -> OAuth consent screen -> Audience: 点击 Publish App按钮