Forum Academy Marketplace Showcase Pricing Features

Allow only certain emails from OAuth domain auth to login?

I’ve searched and read many threads but can’t seem to figure this out.

I have the Google OAuth for our domain working. Only domain Google OAuth users can login and access the app. How do I now restrict access to only specific users (or email IDs) within the domain? I don’t want all users with our Google (domain) authentication to be able to login and access the database. Other users could be redirected to some “no_access” message/page.

Don’t include a signup flow on public pages, maybe only after paying for an account or something. Perhaps, Invite only. When an invite is sent that email goes to an approved list. When signing up, before actually signing a user up, check their email exists in the list.

1 Like

Thanks for the reply. I don’t know if that would work as we must use Google OAuth domain authentication. That’s maybe where I’m stuck. Once a user is authenticated I don’t know how to check that User > email field exists in “email” filed for Allowed_Users type?

1 Like

I misunderstood! Like

My Gmail ends in “Braintrustbh.com

So how to restrict to that domain you mean, right?

If so, check out this thread

Or directly to the docs

I did a poor job explaining. We have Google OAuth setup and app is restricted to allow only our domain.com email login. Now I need to restrict access to a subset of users (or email addresses).

In other words, I need to check that User > Email is in Allowed_Users > Email type or maybe some kind of boolean yes/no if Users Email == Allowed_Users Email then proceed to database_page, otherwise redirect to no_access page.

This might be helpful then

https://support.google.com/a/answer/6160020?hl=en

Thank you. I will check that link. I appreciate your help.

If anyone else knows a way to redirect a user after the successful login based on a field in a non User data type please let me know.

If anyone is interested I got this working using tips from this post – Disabling a user in the user table - #4 by tzuork

1 Like