Search code examples
oauth-2.0google-oauth

How to signup with a personalized email using Google Oauth?


I have an application that authenticates users via Google Oauth. When I click Signup button, a signup screen would pop up as shown in the figure below.

enter image description here

The problem is that I want users to signup emails with domain name of my organization. Specifically, the username suffix should be @my_organization.com instead of @gmail.com as displayed in the figure. I have tried to modify the Oauth Consent Screen but there seems to be no option to configure this.


Solution

  • as you mentioned the "Sign in with Google" is for login purposes through OAuth protocol when the accounts already exists in an organization, I am afraid this is not intended to delegate user creation since this is a task only domain administrators are allowed within an organization.

    The most you can achieve from OAuth is to force the sign in with an specific domain; you can do this by modifying the "hd" parameter in the authentication request you are sending using the Google's OAuth 2.0 API. Here you can check on this topic: click here

    As mentioned above, if you are looking to create user accounts with a specific domain you need to be an administrator in a Google Workspace account.

    I hope this information helps!