How to whitelist only specific domain in Google OAuth2 - django

I was making a registration portal using in Django 4 using Google OAuth2 and need to register people only with a specific domain like abc#akgec.ac.in but I'm not able to figure out how to do it. I'm using social-auth-app-django for setting up Google OAuth Authentication. Can anyone help me?
I have tried using
SOCIAL_AUTH_GoogleOAuth2_WHITELISTED_DOMAINS = ['akgec.ac.in']
but it's not working too.

Related

How do I authenticate to Google Workspace though a Website for User Management?

So we have google login on the website, which is part of the CMS. CMS is hooked up to ActiveDirectory which has GoogleADSync installed.
Our admins are having to make accounts in AD, and on Google, and I want to fix this because it seems beyond cumbersome.
The API seems slick but how do I actually AUTHENTICATE so I can call those endpoints? Other services we use have just an API key to throw into the headers, but the Workspace auth docs seem pretty... heavy. Or is it as simple as using the existing API key we've generated for the website authentication (or make a new key over there in the google console?).
Any help would be great because it seems daunting atm.

How to implement authentication and authorization for web apps

I have been working on a web application. I installed it on AWS EC2 instance. Currently it is available to all the people over the web. However I'd like it be available only for authorized users. Could you please help me on how to implement the google sign in for the app so that only user who authenticate with google sign in can access it.
I had referred to the google sign in for websites doc: https://developers.google.com/identity/sign-in/web/ . It however talks only about implementing the authentication code but not about how it should be connected to the web app.
Where should I place the google sign in code? is it inside the web app code
OR
Should I create a seperate web page for sign in code and redirect it the AWS/web app server IP address?
Thanks
Arun
Google's API Clients, which will let you implement Sign in Using Google, are hosted on Github. Visit https://github.com/google?utf8=%E2%9C%93&query=api and find the repo google-api-[your_language]-client. Follow this tutorial to get started.

Login using Google+ on a Django Site

Hi everyone I want to put a google+ login button on my website (coded in django) w/o using any 3rd party tool like Django-Social-Auth, etc.
So can anyone point me to some tutorial or help me how to do it. I want user to login via Google+ and then I can get their information at backend in django views. I will be then hosting it on Google App Engine so if some GAE API can help me then it will also be great.
I figured out the solution:
Got access_token using https://developers.google.com/+/web/signin/javascript-flow
Then send out the access_token to Server for getting User Details, considering these security measures (https://developers.google.com/+/web/signin/client-to-server-flow).
Use Django CSRF Token functionality to send token safely (https://docs.djangoproject.com/en/dev/ref/contrib/csrf/).

Google Cross Domain Authentication

I have various sites (on their own domain) with their own authentication systems. What I'm trying to do is combine all the authentication into Google's authentication so the users will only have to log in with their Google credentials. What I'm thinking of is that they would log in with their Google credentials and be redirected to a dashboard which has image links to the other sites. The user should be able to go to any of the sites and be automatically logged in since they were already authenticated. I saw that there's an authentication for Google Apps but is this the same thing for my websites?
What I'm not sure about is how does this happen cross domain? How do the other domains know that the user is already authenticated?
Also, if the user logs out, they should not be able to access any of the sites anymore.
Anyone have any experience implementing something like this? Any resources are much appreciated. I will be implementing this in Coldfusion so Coldfusion resources are a bonus.
Your talking about using Google to login/signup i.e. Using OAuth 2.0.
You will need to register each of your app domains with Google. The user will need to confirm each application to allow access (in your case for signup/login).
Resource on Google Login with ColdFusion by Raymond Camden
The point is you need to establish a certain protocol to build a trust.
Other options are:
Google oauth javascript cross domain

Django + Google SSO openid

I would like to have my application http://app.acquee.com/designer to accept a google account as a login. I found a bunch of libs for django but most work on top of existing Django authentication system that I do not use. I have my own set of user tables where I keep user info and privileges.
Any suggestion on how to integrate that with the Google Openid?
Seems I will have to do it manually using python-openid. Or could I use django-openid?
However, with the latter, I don't even know how to issue the discover command.
Regardless, I get stuck on google's step 5, sending a login authentication request (optionally with OAuth parameters) to the provided endpoint address. Can someone provide a sample request? is it a GET/POST? content?
Cheers
You can try https://launchpad.net/django-openid-auth - I'm using it in a commercial project, for both regular Google Accounts and Google Apps accounts. I remember that it was the most convincing one at the time I was doing a review, although I can't give you any details now due to my short memory. Anyway - it's working great.