Allow only Google Workspace accounts with Google OAuth SSO - oauth-2.0

I'm using Google OAuth SSO to authenticate users to my website.
How do I show only Google Workspace (GSuite) accounts inside the Google "Choose an account" screen, instead of showing all Google accounts (gmail)?
Like the website https://www.g2.com/authorize did
Thanks,
Shahar

I found the solution.
When redirecting the user to the https://accounts.google.com/o/oauth2/auth/oauthchooseaccount url, you should add the query param hd=* and as a result Google would show only Google workspace accounts.
However, the user still can manually enter a gmail account.

Related

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.
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.
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!
You can only use oAuth with registered Google accounts.
With Google Workspace you can use a domain in your Gmail, see.
But if that's not possible and you want a quick way to authenticate, maybe Auth0 or similar tools can help.

Is it possible to add a callback URL to Create Google Account flow?

Our app requires Google OAuth2. When a user, with an existing Google account, authenticates with Google then we use a callback to return users to our App. This is what we want.
The issue is, for those users who do not have a Google account we ask them to create a Google account (gmail address) or connect their existing email address to Google. A user who has to follow either of these flows ends up on the "Thanks for creating a Google account page" and not back at our App.
This is supposed to work as you are expecting. There is a continue button on that page and that should bring the user back.
If that is not working, can you tell us more (about OS, client id, urls and the exact steps) or give us a link to test/reproduce? Is this on the web or on mobile app?

Google sheets auto log sign ins/outs

All of our users have a Google email account. We also have an office sign in/out Google form that populates a spreadsheet that is displayed on our Google site page so the boss can see who is in the office. This is owned by our office Google account but can be edited by anyone in our office (with their own Google accounts). After signing into Google email, users have to fill out the sign in/out form.
Is there any way for the Google email sign in & out to get logged automatically to a Google Sheet? This would eliminate the need for our users to use the Google form.
It is possible to get users sign in / out using the reports API but checking where that sign in / out event happened is far more complicated.

"Create an Account" link missing from Google OAuth2 login page

I'm implementing an iOS app which uses Youtube Data API v3. In order to get the OAuth access token, I'm opening Google OAuth 2.0 Auth page as specified in the documentation.
The Google Account login form I'm seeing contains fields for Email and Password, but not the "Create An Account" link for those users who don't yet have a Google/Youtube account. I need to support the scenario where users may not have Google/Youtube accounts, and I would like to offer them chance to create the Google/Youtube account as part of the authentication flow.
Is there some option which can be used to enable the "Create an Account" link?
Found this from GTM OAuth 2 Discussion:
Unfortunately, there's not currently an option for controlling
appearance of a sign-up link in the sign-in interface for Google
accounts.

Integrate Google account login into a iOS app

I want to login in my iOS App with a Google account. Instead of having a database with users and having to register all the users, I simply login with my existing Google account.
Anyone knows a way of doing this, or a tutorial?
Google Accounts Authentication and Authorization for Mobile Apps has fairly detailed instructions for authenticating Google account users and includes iOS-specific steps.

Resources