我无法在Heroku上部署Google OAuth应用程序

3

我正在Heroku上部署Google OAuth应用程序。为此,我必须将应用程序域验证给Google管理员,但Heroku应用程序URL不同,Google网站管理员无法接受。有没有办法验证Heroku URL。https://stormy-sea-79521.herokuapp.com/

1个回答

4
当然可以!验证您的域名拥有权有几个选项。推荐的方法是在您的应用程序中添加一个 html 验证文件,位于https://stormy-sea-79521.herokuapp.com/。 您应该能够从 Google Search Console 中下载该文件,然后部署到项目的根目录下,例如:https://stormy-sea-79521.herokuapp.com/googlexxxyyyyzzz.html
生成 html 文件的步骤如下:
  1. 登录Google Search Console(之前称为Google网站管理员工具);
  2. 在 Property 菜单中,选择“添加属性”, Add property menu is in the top right of the GSC
  3. 输入网站URL:“https://stormy-sea-79521.herokuapp.com/”;
  4. 点击“继续”;
  5. 下载 Google 提供的验证文件,如下所示: Download a Google verification file
  6. 上传此文件到您的 Heroku 实例,保持 Search Console 处于打开状态,最后
  7. 在 Search Console 中点击“验证”按钮;
  8. 庆祝吧!
还有其他验证方法。您可以将一个特定的 meta 标签添加到主页中,或关联您的 Google Analytics 或 Google Tag Manager 帐户。详情请参阅Google 的文档以了解如何验证您的域名

@Graerne 非常感谢您的回复。由于我是一个 Node 的新手,我不知道如何在 Node 应用程序中添加 HTML 元标记。刚刚查看了 Heroku 文档(https://devcenter.heroku.com/articles/getting-started-with-nodejs),并解决了这个问题。 :) - user1744669

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接