Google 授权的重定向 URI

Google Authorized redirect URIs

假设我的应用程序的主域位于 https://www.example.com

应用程序将有很多实例,即

https://www.example.com/client1

https://www.example.com/client2

https://www.example.com/client3

<..>

为了对我的应用程序进行 OAuth2 身份验证,我目前有这样的重定向 URI:

https://www.example.com/client1/SignInGoogle

https://www.example.com/client2/SignInGoogle

有没有办法为所有这些客户端添加一个授权重定向 URI?即

https://www.example.com/*

https://www.example/com/*/SignInGoogle

或者此 URI 是否必须 完全 匹配?

如果您查看 Google 开发者控制台

  1. 必须有协议 (HTTP / HTTPS)
  2. 不能包含 URL 片段 (#)
  3. 不能包含相对路径。
  4. 不能是 public IP 地址。

相对 URI 与绝对 URI 的示例

Relative URI    Absolute URI
about.html      http://WebReference.com/html/about.html
tutorial1/          http://WebReference.com/html/tutorial1/
tutorial1/2.html    http://WebReference.com/html/tutorial1/2.html
/                   http://WebReference.com/
//www.internet.com/ http://www.internet.com/
/experts/           http://WebReference.com/experts/
../                 http://WebReference.com/
../experts/         http://WebReference.com/experts/
./about.html    http://WebReference.com/html/about.html

您想要做的是类似 Relative URI 的事情。您需要记住的是,身份验证服务器不过是一项 Web 服务。如果您无法从普通 Web 浏览器访问重定向 URI,则身份验证服务器也无法访问。

所以你不能做到它必须完全匹配。