简体   繁体   English

如何将 Google Cloud Platform 中的“localhost”添加为 OAuth2 的授权域

[英]How to add the 'localhost' in Google Cloud Platform as an authorized domain for OAuth2

Question:问题:

How do I add the Google Cloud public facing localhost to the authorized domains list so I can set up OAuth?如何将 Google Cloud 面向公众的 localhost 添加到授权域列表,以便我可以设置 OAuth?

Background背景

I'm trying to follow this Google Dev tutorial on Building a Node.js Web App using Google Cloud Platform .我正在尝试按照此 Google Dev 教程使用 Google Cloud Platform 构建 Node.js Web App

Some of the instructions seem slightly out of date, but I've managed to work around it so far.有些说明似乎有点过时了,但到目前为止我已经设法解决了它。 On Page 9, In section 'Setting OAuth 2.0 Client' step 9 (listed below) it says to paste in the URL https://8080-dot-<9 digit number>-dot-devshell.appspot.com/ with my 9 digit number replaced: On Page 9, In section 'Setting OAuth 2.0 Client' step 9 (listed below) it says to paste in the URL https://8080-dot-<9 digit number>-dot-devshell.appspot.com/ with my 9数字替换:

在此处输入图像描述

Problem问题

When I paste in the URI, I'm told that the URI needs to be added to the authorized domains list:当我粘贴 URI 时,我被告知需要将 URI 添加到授权域列表中:

授权的重定向 URI - 无效的重定向

While that's not in the instructions, I went ahead and did as instructed.虽然这不在说明中,但我继续按照指示进行操作。 But every time it goes to 'verify' the domain, it keeps getting a rejection screen saying:但是每次它去“验证”域时,它都会收到一个拒绝屏幕,上面写着:

网站管理员中心 - 验证失败

So what on earth do I do here?那么我到底要在这里做什么呢? It won't let me make the OAuth key without the verified domain, and it won't let me verify the domain.它不会让我在没有验证域的情况下制作 OAuth 密钥,它不会让我验证域。

I am guessing the "[...]-dot-devshell.appspot.com" url in 2017 used to forward directly to the web server you wanted to test.我猜 2017 年的“[...]-dot-devshell.appspot.com”url 用于直接转发到您想要测试的 web 服务器。

This must have changed in the meantime to require authentication before accessing the web page.与此同时,这必须已更改为在访问 web 页面之前需要进行身份验证。 This is blocking the configuration of the OAuth since the URL redirects to a different website.这阻止了 OAuth 的配置,因为 URL 重定向到不同的网站。 This is why you are not able to finish the codelab.这就是您无法完成代码实验室的原因。

What you could do is try a more recent codelab such as this one to practice with Node.js你可以做的是尝试一个更新的代码实验室,比如这个,用 Node.js 练习

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM