Google Authentication and Fetching mails from scratch means without using any module which has already set up this authentication process.
We’ll be using Google API python client and oauth2client which is provided by google.
Sometimes, it really hard to implement this Google authentication with these libraries as there was no proper documentation available. But after completing this read, thing will be clear completely.
Now Let’s create Django 2.0 project and then implement Google
authentication services and then extract mails. We are doing extract
mail just to show how one can ask for permission after authenticating
The first step is to create virtual environment and then install the dependencies. So We’ll be using venv:
mkdir google-login && cd google-login python3.5 -m venv myvenv source myvenv activate
This command will create one folder myvenv through which we just activated virtual environment. Now type
pip install Django==2.0.7
That is Django version which we used but feel free to use any other
version. Now next step is to create one project, let’s name it gfglogin:
django-admin startproject gfglogin .
Since we are inside google-login directory that’s why we want django
project to be on that present directory only so for that you need to use
‘ at the end for present directory indication. Then create one app
django-admin startapp gfgauth
Since we created one app. Add that app name into settings.py in INSTALLED_APP list. Now we have Django project up running, so let’s migrate it first and then check if there is any error or not.
django-admin startapp gfgauthpip freeze
Create your free account to unlock your custom reading experience.