-1

Since Google Auth does not support wildcards in its redirect URL's, I am trying to create a proxy solution for Google Authentication. I have read the following two posts but need some more clarifications

  1. How to deal with arbitrary amount of redirect URIs?
  2. Subdomain in Google Console Redirect URIs

Primarily I have one domain say www.abcxyz.com
I need to have the Google Auth mechanism work for number of subdomains say:
alpla.abcxyz.com
beta.abcxyz.com
and so on for dynamically created subdomains

Following is something I want to try:

  1. I will have only 1 redirect URL in the client secret json file say google.abcxyz.com
  2. When creating a redirect url I pass the name of the subdomain 'alpha' in the state parameter
  3. Once auth code is sent from google to google.abcxyz.com my proxy code reads the state parameter and forwards the request to alpha.abcxyz.com. This domain will then exchange the auth code for access token and refresh token.

Will this kind of mechanism work or do I need to do something more?
Will access tokens work from the subdomain?
What happens when access token expires?

4

1 回答 1

0

我最初认为这个问题将成为我的系统自动化的一大障碍,但看起来有一个简单的解决方法。

  1. 重定向 url 应包含主域,并且应同时出现在 Google 客户端机密和 Google API 控制台中。
  2. 传递状态中的子域名。
  3. 在主域 Apache Config 中读取查询字符串并相应地重定向。(阅读此博客以了解如何根据查询字符串进行重定向)。
于 2013-03-15T10:03:03.173 回答