I want only users from a @companyname.net email or from a list of email addresses to be able to sign in with Python Social Auth through google+. How would I accomplish this?
SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS = ['companyname.net']
is what I currently have in settings.py, but that only allows @companyname.net-ers to sign in.
Limiting the registration to some emails OR domains is called whitelisting.
As the documentation explains, you have two possible ways of whitelisting, namely by supplying a
list of domains to be whitelisted, SOCIAL_AUTH_<BACKEND_NAME>_WHITELISTED_DOMAINS = ['foo.com', 'bar.com']
list of email addresses to be whitelisted, SOCIAL_AUTH_<BACKEND_NAME>_WHITELISTED_EMAILS = ['me@foo.com', 'you@bar.com']
Since OP wants
to allow everyone for @companyname.net and only some specific others from other domains.
then OP can keep using SOCIAL_AUTH_<BACKEND_NAME>_WHITELISTED_DOMAINS
as OP is already doing and also introduce SOCIAL_AUTH_<BACKEND_NAME>_WHITELISTED_EMAILS
to add the specific emails OP wants also to login.