google url 缩短器中的功能或错误取决于身份验证方法

Feature or bug in the google url shortener depending on authentication method

如果在请求中传递 api 键时调用插入方法,则传递 url 就像 http://mostmedia.com/recent-projects 总是 returns 一样缩短 url.

但是,如果您使用 OAUTH 进行身份验证,那么您传入的每个长 url 都会获得一个新的唯一 ID,即使它们相同。

当您打开和关闭 OAUTH 身份验证时,您可以在 api 资源管理器中看到此行为:

https://developers.google.com/url-shortener/v1/url/insert

我在任何地方都看不到这方面的记录,所以很难知道这是一个功能还是一个错误,或者我们如何期待它在未来的表现。

有谁知道关于此的官方 google 行吗?

这是预期的行为,请参阅本文档中标题为 "Creating links when you’re signed in vs. signed out" 的部分:https://support.google.com/faqs/answer/190768 应对如下:

Creating links when you’re signed in vs. signed out

Signed in

  • Your links are automatically added to goo.gl where you can track their use.
  • A unique short URL is created each time a long URL is shortened.

Signed out

  • Your links won’t show up on your goo.gl page.
  • The same short URL is reused each time a long URL is shortened by you or someone else.

该文档指的是消费品,但该行为也适用于 API。 OAuth 身份验证 API 等同于 signed-in。

每次调用都会返回一个新短 URL 的原因是您可以利用多个 short-urls 进行跟踪。