最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to Use the Same Google OAuth Credentials Across Two Domains - Stack Overflow

programmeradmin1浏览0评论

I have two domains: let's call them A (currently in production) and B (a test domain).

For reasons I can't disclose, I need to switch from A to B while keeping everything else the same except for the domain name.

The biggest concern is OAuth login via Google.

Currently:

  • The Google OAuth consent screen has been submitted and approved with A as the application homepage.
  • B is already included in the authorized domains list in this application.
  • I have separate client IDs issued for A and B. (but same application)

My Plan:

  1. Update the application homepage in the Google OAuth consent screen to B and go through the review process again.
  2. In the OAuth settings for A's client ID, add B to the Authorized JavaScript Origins and Authorized Redirect URIs.
  3. In the OAuth settings for B's client ID, add A to the Authorized JavaScript Origins and Authorized Redirect URIs.
  4. Keep the client ID and secret unchanged in both the production and development servers (since I want existing users from A to continue using their accounts on B without any issues).

Concerns:

Once step 1 is completed (changing the consent screen to B and getting approval), will OAuth stop working on A?

Ideally, I want to transition seamlessly without breaking OAuth authentication on A before fully switching to B. (One or two hours is fine.)

Is my approach correct? If not, what would be the best way to handle this transition?

发布评论

评论列表(0)

  1. 暂无评论