我已在网站(example.com)上实现了Google oAuth。除了来自我的站点子域名(我有成千上万个子域名)的授权之外,一切都正常运作。当用户尝试通过子域名进行授权时,例如
fr.example.com
product1.example.com
product2.de.example.com
我从谷歌那里接收到一个错误信息 -
The redirect URI in the request did not match a registered redirect URI
如何解决这个问题?
https://sub.domain.com/authenticate/google
,https://sub2.domain.com/authenticate/google
等等。如果您需要自动执行此操作,则可能会很复杂。我不知道谷歌是否有任何API可以自动添加OpenAuth端点。 - KajMagnus*.domain.com
上时,例如sub5.domain.com
,我会将他/她重定向到login.domain.com
并通过该域名登录。因此,我在Google OpenAuth中列出的唯一端点是https://login.domain.com/authenticate/google
。当有人登录时,Google总是会询问他/她是否信任那个域名,而不是sub5
。通过cookie和服务器端缓存以及重定向,我确保用户在sub5
上登录。 - KajMagnus