Python 3 Flask-Login Project to Build Google OAuth2 Login & Logout System Using SQLite Database
Dec 10, 2025
Buy the full source code of application here:
https://procodestore.com/index.php/product/python-3-flask-login-example-to-build-user-authentication-system-with-logout-using-html5-templates/
Show More Show Less View Video Transcript
0:00
Uh hello friends today in this tutorial
0:02
I will be telling you that how basically
0:04
we can build a O2 Google login and
0:07
logout system inside your flask
0:10
application inside Python. So you can
0:12
see that guys this is a screenshot of
0:14
this application. So basically if you
0:16
load this application inside your
0:18
browser there will be a login button out
0:20
there and if I click this login button
0:22
you will be seeing you will be
0:24
redirected to the user screen where you
0:26
can select your Google account to which
0:27
you will need to login. I will select my
0:30
coding sika account here and after that
0:32
it grant the permission and it will show
0:34
you the name. Hello coding sika you are
0:36
logged in your email addresses this one
0:39
gotham 1997 at the redgmail.com and this
0:42
is your profile picture and also we have
0:45
got the log out button also. So if you
0:47
press this log out button you will be
0:50
automatically
0:51
uh logged out from your account. If I
0:53
press this log out button you will see
0:55
it will redirect me to the homepage. And
0:57
once again if I hit this button you will
0:59
see it will again redirect me to you can
1:01
take any account. For example if I take
1:03
this account I hit the same endpoint
1:06
localhost 5,000.
1:09
So again there is will be the interface.
1:11
So this time you need to grant this
1:13
permission like this.
1:16
And now you can see that basically it is
1:18
showing you the name email address this
1:20
one log out button also.
1:23
So once basically it saves this it saves
1:26
it inside a database called as SQLite
1:28
that's why we don't need to continuously
1:31
grant the permission you just need to
1:32
grant the permission only once after
1:35
that it will store this information
1:36
inside a SQLite database which we will
1:39
use inside flask application so SQLite
1:42
database basically let me SQLite it's a
1:46
very popular database so we are using
1:48
this database inside this application to
1:51
store the data And uh also guys we are
1:54
using a Python module called as flask.
1:59
Flask as you all know it's a web
2:00
application framework for building web
2:02
applications inside Python. We are using
2:05
using this framework and for building
2:07
this O2 login system. We are using a
2:11
flask dependency called as flask login.
2:14
This is the basic dependency we are
2:16
using guys. It's a package which makes
2:18
things very much easy in order to
2:20
implement this functionality. So we are
2:22
using this module. So simply install
2:24
this module by this pip install flask
2:26
login command. So for the for the full
2:31
source code guys I have written a
2:33
complete blog post on my tutorial
2:35
website and uh you can read this blog
2:38
post alongside with watching this
2:40
detailed video. So I will be going into
2:43
the minute detail of this tutorials. So
2:45
you can copy paste all the tutorials. So
2:47
if you have any sort of confusion you
2:49
can even buy the full source code. There
2:51
is a option high right here. You can buy
2:54
from Visa card or UPI bank. So there are
2:57
two options out there. So let's start
2:58
building this tutorial. So first of all
3:02
guys I will delete this database and
3:03
start from scratch and show to you how
3:05
basically it is done.
3:08
Let me first of all stop this
3:09
application which is running here. So
3:13
let me delete this database and also
3:15
delete this catching folder as well. So
3:18
whenever you get this this will be the
3:20
directory structure of this application
3:22
guys. So here this is the information
3:24
that you will need. I will show you how
3:26
basically you can get this information.
3:28
This is the client ID and the client
3:30
secret. You can get this information
3:32
inside uh Google cloud console. So
3:35
basically in order to use Google APIs
3:37
you need some kind of authentication. So
3:40
let me show you how basically it is
3:42
done. You need to go to Google cloud
3:44
console create account and click on this
3:47
create credentials button. Click on co
3:50
to client ID and the application type
3:52
will be web application and inside this
3:55
authorized javascript origins. So this
3:57
you need to put here the homepage of the
3:59
URL. So basically I'm developing it on
4:03
http localhost port number is 5,000. So
4:06
this is the homepage that you need to
4:08
put and the redirect URI is basically
4:11
the URL that to which the application
4:13
will redirect whenever you grant the
4:15
permissions. So we will be redirecting
4:17
the user to this URL http localhost 5000
4:22
/ login/allback.
4:24
[snorts] This is the URL. So make sure
4:27
that you put your own URLs. So once you
4:30
create this you will get your client ID
4:31
and client secret and simply you need to
4:34
paste it inside this env file
4:36
environment file. This this is your
4:37
client ID and uh this is your client
4:41
secret. So this information is very
4:44
confidential that's why we are storing
4:45
it inside this environment file. So like
4:48
this. So once you load this application
4:50
guys
4:52
once you do this you again need to grant
4:54
the permission. So whenever I run this
4:56
application first of all it will
4:57
initialize the database. You will see
4:59
this SQLite database file is created and
5:01
this pi catch folder is also created. So
5:05
whenever you run this for the very first
5:06
time and now your flask application will
5:09
start on port 5,000. You will see that.
5:12
Now if I once again start this
5:14
application localhost 5,000.
5:18
So once again
5:20
I need to
5:23
you will see this is the application.
5:26
Click on login and you will be
5:28
redirected to the account page. You need
5:30
to select your account once again and
5:33
you will see that this information will
5:35
be triggered. So very simple script. Let
5:38
me show you how basically it is done. So
5:40
inside this me uh schema.sql file guys
5:44
you will see this is the SQL light
5:46
database and inside this we are creating
5:48
a table which is called as user. So
5:52
basically it contains these three
5:53
information that we are displaying it on
5:55
the screen. Here you will see this is
5:56
the name of the person which is coding
5:58
sixure. This is the email address and
6:00
this is the profile picture. So these
6:02
three fields we are storing it inside
6:04
this table. ID is the primary key of the
6:06
table. So it's auto incremented. Name is
6:10
text, email text and profile pick is
6:13
also text. So they are not not null. So
6:16
this is the table that you need to
6:18
create. So for the requirements guys we
6:20
are using this request module
6:23
flask or library py open SSL flask
6:28
login. So you will get all these files
6:30
whenever you purchase or want to do it
6:32
manually also you can just copy paste
6:35
this code and simply there is a command
6:37
out there inside uh pip. So basically
6:40
you can uh [snorts] install all these
6:42
dependencies as at once. So simply type
6:44
this command pip install - r
6:48
requirements
6:50
txt. So this will install all the
6:52
dependencies which are present inside
6:54
your file. Here you will see that one by
6:56
one it will install all the
6:58
dependencies. You will see that.
7:02
So after this you just need to run your
7:05
project. Simply write python app. py. So
7:09
at last
7:14
so in this way you can do this process.
7:16
It's very simple.
7:20
So now let's get started guys by
7:21
building this uh script from scratch. So
7:24
let me delete all the source code from
7:25
app. py and let me write this code step
7:28
by step. So first of all guys you need
7:30
to import the JSON module and operating
7:32
system. These are all built-in modules.
7:34
SQLite
7:36
3. This is for the database. And here we
7:38
need to set a environment variable guys.
7:40
This is very important because we need
7:42
to set this or to library
7:46
insecure
7:48
transport. So this variable need to be
7:50
set because we are building it on local
7:52
host. We are not building on a live
7:54
website. That's why we will be using the
7:57
protocol HTTP. So that's why you need to
7:59
set this option to one. And then we need
8:02
to import the flask module guys. From
8:05
that we need to import the base library
8:08
of flask
8:09
and then we need to import the redirect
8:12
module for redirecting the user to
8:14
different pages request and URL 4 and
8:17
also we will be importing the flask
8:19
login module guys flask login from that
8:22
we need to import some methods out there
8:25
so it contains a login manager class
8:28
and also it contains a variable of
8:30
current user to keep track of the user
8:33
the state of the user whether it's
8:34
authenticated or not. After that we have
8:38
the login required. This is for the
8:40
validation. The user must be login and
8:43
login user. So this will contain the
8:45
information about the logged user and
8:47
log out user. This is a method used to
8:49
log out a user. So these are different
8:51
kinds of methods available right off the
8:54
bat for us for implementing the
8:56
authentication. So this makes it very
8:58
much easy. After this guys, we just need
9:01
to import our oat
9:04
library
9:06
and from that we need to import the o2
9:09
version and from this we need to import
9:12
the web application client.
9:15
So there are two options out there. You
9:17
will see in the drop-down we need to
9:19
implement the first option which is web
9:21
application
9:22
client. This one option. So we are
9:25
building it on the client side that's
9:26
why. And then we need to also import the
9:29
request module guys also. So request
9:33
that's it. So these are all the
9:35
dependencies which are there for this uh
9:37
project guys and from internal
9:40
dependencies from the database file that
9:42
we have defined. You will see db.py. So
9:45
this contains the all the database code
9:47
out there. So here we are connecting to
9:49
the SQLite
9:51
DB which we have created. You will see
9:53
that it is doing the connection here and
9:56
basically it is connecting to the SQL
9:58
file which we have defined right here
10:01
schema.sql. So all this database related
10:04
code is present inside db. py. So we
10:07
just need to import this file inside our
10:09
base project. So we will be doing this.
10:12
So from db we need to import the command
10:16
which is init db command and from the
10:19
user file the user model file we need to
10:22
import the actual model which is user.
10:24
So if you check this is the file user
10:27
and basically we are storing three
10:29
variables ID name email and profile
10:32
picture. So basically we are
10:34
initializing the database selecting all
10:36
this information from a database using
10:38
the select statement and then in order
10:41
to insert we are using the insert
10:43
statement you will see that. So I think
10:46
if you studied SQL you will uh be
10:49
knowing what these statement do. So
10:52
inside we are just fetching all these
10:55
libraries and now we just need to
10:57
basically guys configure
11:00
the client ID and the client secret. So
11:04
Google_client
11:06
id. So we can do this using the
11:08
environment variables. We can get
11:11
the first will be the client ID which we
11:13
have defined. So this will be
11:16
google_client
11:18
id and uh comma the second parameter is
11:22
none here. [clears throat and snorts]
11:24
And similarly we will say google client
11:27
secret.
11:28
We will also get this using the same one
11:32
which is
11:33
google client
11:36
secret.
11:39
So this needs to be same guys. If you
11:41
see inside env file, this needs to be
11:44
same Google client ID, client secret.
11:46
These keys needs to match. So we are
11:49
fetching it from the environment file.
11:52
After this guys, we need the third
11:54
option which is the discovery URL. This
11:56
is necessary.
11:58
So this will be nothing but a static URL
12:00
that we need to pass here which is
12:02
httpac accounts.google.com.
12:05
So this is a URL from which you will
12:07
select your accounts. So it is present
12:11
inside this folder which is wellnown
12:14
open id configuration.
12:17
So inside your root directory you will
12:19
see basically it has created this pi
12:21
catch and basically it is fetching from
12:23
here.
12:26
So this is done and now we need to
12:28
initialize our flask app.
12:31
We will simply say here flask name. So
12:35
this will start this Flask application
12:37
on port number app dot secret key
12:41
operating system environment
12:44
get secret key. So you just need to set
12:47
a secret key guys. So we are just
12:50
getting a secret key or you can if the
12:53
in if this is not set then we can simply
12:57
uh just generate one using random
13:00
variable 24 character secret key. That's
13:03
it. You can even set it inside your
13:05
environment variable as well. Just
13:06
create a secret key here.
13:10
So after this guys, we will simply
13:14
[snorts] start this flask application.
13:16
In order to start this, it's very
13:18
simple. Basically, you just need to
13:21
define a if block
13:25
name is equal to double equal to main
13:30
colon. And here we can app.tr dot run
13:33
and here we can pass the option debug to
13:36
true.
13:39
So this will start your flask
13:40
application. So basically if you just
13:42
run this application now
13:45
pythonam. py you will see that it will
13:48
start this application 5,000. If I load
13:51
here nothing will happen. You will see
13:52
not found error is coming because we
13:54
haven't configured any sort of route. So
13:57
here we just need to configure some
13:59
route.
14:00
So for configuring it guys, first of all
14:03
we just need to first of all initialize
14:06
some variables. Let me delete this file
14:10
here which is there.
14:13
SQLite DB.
14:17
So the file is deleted. Let me also
14:19
delete this file also.
14:22
Yeah. So nothing is present. So now we
14:25
just need to create a database guys. So
14:27
first of all after you do this we just
14:29
need to initialize the flask login. So
14:32
we need to make a login manager class
14:34
and this will be login manager. We will
14:37
initialize this. So you can see we are
14:39
importing this from the flask login. So
14:41
it will initialize this constructor and
14:44
after this login manager it basically
14:47
has a method here which is initialize
14:50
app and here we will pass the app that
14:52
we configured which is the flask app we
14:54
are passing here. So after this guys we
14:58
just need to initialize a handler here
15:00
which is the login manager handler
15:04
unauthorized
15:07
handler. So basically if any sort of
15:09
unauthorized people has entered in the
15:11
in the application we will initialize
15:13
this method for them.
15:16
So inside this we can simply return a
15:18
statement you must be
15:21
locked in into access this content
15:26
like this.
15:28
So this simply means that if someone
15:30
enters without authentication we will
15:33
simply print out a message like this.
15:36
So this library is very much helpful in
15:39
printing out these error messages. Now
15:41
we just need to create basically guys uh
15:45
we need to call this init db command
15:47
that we are importing. Basically this
15:50
will create the database for us inside
15:53
except we can simply say SQLite 3. If
15:56
any sort of operational error take place
15:58
in that case
16:01
we can simply pass.
16:04
So with this line of code guys if I see
16:07
if I now execute it you will see my
16:09
database will be first of all created
16:12
python app. py in the left hand side you
16:15
will see it will create this SQLite db
16:17
and this py catch folder. So now if you
16:21
execute for the second time it will
16:23
start the flask application.
16:26
So after you do this guys, it will only
16:29
execute for the very only one one time
16:32
because it will create the database.
16:35
After this guys, we just need to
16:38
configure our o2 client. This will be
16:41
web application client and here we just
16:43
need to pass our Google client ID s
16:46
simply like this. So this will configure
16:50
your O2 client
16:53
and then guys we just need to basically
16:55
initialize a helper [snorts] login
16:58
manager. Once again we will use user
17:01
loader. This is the one and inside we
17:04
will initialize a function. Whenever the
17:07
user is loaded, it will have its own
17:10
user ID
17:13
and basically we just need to return
17:16
the user with the user ID which is given
17:20
like this. Basically we will fetch the
17:21
user based upon the user ID given and
17:25
now we will be initializing the home
17:27
route guys. So whenever user visits the
17:29
homepage,
17:32
so basically whenever user visits the
17:35
homepage what should happen? We will
17:38
initialize the index method
17:41
and here we will simply say if current
17:44
user
17:46
is authenticated in that case we will
17:49
display the information.
17:51
So there is a property here which is
17:53
called as is authenticated. This simply
17:55
means that the user is logged in. So
17:58
this current user we are getting it from
17:59
the flask login once again. You will see
18:02
that we have successfully imported at
18:04
the very top. And right here guys we
18:07
just need to return some message here.
18:10
So we can simply return something here.
18:13
Let me just do this like this.
18:18
And this is our if statement.
18:21
And we can even have a else one also. If
18:23
the user is not authenticated in that
18:25
case we will simply return a Google
18:29
login button. So inside the single
18:31
quotes we can just write.
18:35
So we can have a return statement here
18:38
like this. Just wait.
18:44
So this is your statement guys. You will
18:46
see this is the login button. If I now
18:49
execute this what what should happen?
18:54
So it will automatically restart. You
18:56
will see
18:58
this login button is uh executing it
19:01
because the user is not authenticated.
19:05
So if I execute this you will see not
19:07
found. We need to write this code here /
19:10
login. So whenever user go to this page
19:13
we need to write some code for this.
19:15
So once again we will initialize a new
19:17
route for this endpoint which is a
19:20
simply a get route app.t route / login
19:26
and here we will have a login method
19:30
and basically here guys we will simply
19:33
uh get the configuration URL. We will
19:37
define this variable and basically here
19:40
we just need to define a method here at
19:42
the very bottom which will basically
19:44
return the information for us inside a
19:46
JSON response. So this is the method
19:49
basically just declare it at the bottom.
19:51
So it simply basically will return the
19:53
information for us. We will pass the
19:56
Google discovery URL. [snorts] So this
19:59
will simply get the information for us
20:03
and it will store it inside this
20:05
variable
20:07
which is uh
20:10
Google provider. So here we just need to
20:13
provide a simple information here guys.
20:15
Authorization
20:20
endpoint
20:22
like this
20:24
and uh after this guys oh sorry this
20:30
this is just like this and after this
20:32
one we need to get the authorization
20:38
endpoint. So we can get this using
20:41
Google provider configuration and
20:43
basically it is it is an array basically
20:46
it is a property here which is
20:48
authorization
20:50
endpoint
20:53
and here we just need to basically
20:55
prepare the user and we will simply say
20:58
request URI and we will simply use this
21:02
method which is you can also get a
21:04
access token you can also add a token as
21:07
well we will use this prepare here
21:12
uh request URI. This is request URI.
21:17
And basically guys, it takes some
21:18
options here. First option it takes is
21:21
the authorization endpoint. We will
21:23
simply pass it. Second, it takes the
21:26
redirect URI. So this is very important
21:28
guys. Whatever you configured inside
21:30
your Google cloud console, you just need
21:33
to replace the same value here. So
21:35
simply replace this value authorization.
21:38
So simply copy this value. We can even
21:41
write like this in dynamically also
21:44
in my case which is uh the base URL of
21:47
the application which is localhost
21:50
5,000.
21:51
And then we can concatenate
21:54
callbacks
21:56
like this. This is the redirect URI.
22:01
[snorts] So scope will be whatever
22:03
scopes that you want to do. You need
22:06
open ID. We need
22:09
the email scope and we will also need
22:12
the profile picture as well. So profile.
22:15
So whatever scopes that you need here
22:17
you can provide here like this. This is
22:20
the redirect URI guys. Basically HTTP
22:22
localhost 5000/ login/ callback. [gasps]
22:27
So after you do this guys basically we
22:29
just need to redirect the user. So for
22:31
redirecting it we will use the redirect
22:33
method and simply pass this request URI.
22:38
So what it will do guys basically
22:40
whenever you click the login button. If
22:42
I now execute this application.
22:47
So if I go to the browser click on this
22:50
login. So it will load this.
22:55
If I now simply go to localhost
22:58
5,000 click on this button. So it will
23:02
basically say
23:05
uh it is saying that your uh let me
23:08
select it for a different account
23:09
because this is already authenticated.
23:12
Let me select this account.
23:15
You will see as I hit this endpoint here
23:17
it will redirect me to the uh account
23:19
page. And here you can select your
23:21
account. And as I select your account
23:24
guys, basically you need to handle this
23:26
uh call back URL. You need to get this
23:29
authorization code here which is there
23:31
after question mark code is equal to you
23:34
need to get this value. So in order to
23:36
get this value we need to initialize the
23:38
endpoint where we can simply handle
23:40
this. So just after this we will define
23:43
a route simple get route.
23:46
So this will be the
23:50
call back URL which is / login/ callback
23:55
and this will be a call back function
23:58
and uh inside this we need to get the
24:00
authorization code. So we can simply get
24:03
get this using request dotarguments dot
24:06
get and we will get the code property
24:08
here which is the authorization code and
24:12
with the help of this authorization code
24:14
guys we can now get the access token.
24:17
So again we just need to repeat the same
24:19
process here.
24:22
This is slightly big code guys. So
24:24
simply write it. So first of all you
24:26
need to say Google provider
24:30
configuration
24:32
and we can simply get it using this
24:35
method that we defined and we can get
24:37
the token token endpoint.
24:42
So we can simply say this is an array.
24:44
So we can simply now fetch the token
24:47
endpoint. So this will be for the access
24:49
token. And now we again need to prepare
24:52
the token URL guys. So we need to
24:58
basically extract token URL headers and
25:00
the body. So we can simply say
25:03
client.prepare
25:04
token request. So [snorts] this is a
25:07
method we will use and inside this it
25:09
takes the token endpoint and the second
25:13
parameter it takes is the authorization
25:16
response. So this will be the simply
25:19
request dot URL guys request dot URL
25:23
and the third option it takes is the
25:25
redirect URL
25:27
and this is equal to the base URL of
25:30
your application request.base dot URL
25:32
and the fourth one is the authorization
25:34
code. So this is equal to code
25:37
which we have configured. So code is
25:39
equal to code. That's it. So now you
25:43
just need to basically get the access
25:45
token guys. So just make token response
25:48
variable and here we can simply make a
25:51
post request and inside this post
25:54
request we will pass the token URL we
25:59
will pass the headers which we got
26:01
headers we will pass the data which is
26:05
equal to the body.
26:08
So you can see we are passing the token
26:10
URL headers body which we just uh
26:13
extracted. you will see headers, body,
26:15
token, URL and the fourth one is the
26:18
authentic authentication.
26:20
So this will be for the we will pass
26:23
here Google client ID and the Google
26:26
client secret. So these two things we
26:29
will pass here inside authentication.
26:31
This is an basically an object. And then
26:34
guys after doing this we will simply get
26:36
the access token using we will client
26:40
dotparse
26:42
request body response. We will use this
26:45
method and basically it will parse the
26:48
response and uh we will simply say
26:51
JSON.dumps
26:53
and here we we need to get the access
26:56
token. So access token is there inside
26:58
token
27:01
response dot JSON. That's it.
27:06
So now after this guys we will simply
27:11
now to fetch some information about the
27:13
user it's very simple.
27:17
Now to fetch the user information we
27:19
will simply make use of this uh access
27:22
token. So we will simply say user info.
27:25
we will define a variable user info
27:28
endpoint
27:29
and here we will again use this array.
27:32
So this time we need the user info
27:36
endpoint.
27:38
So after doing this we just need to
27:41
[snorts] get the URI the headers and the
27:45
body. So we can again use this method
27:47
client. This time we will use the access
27:50
token. we will use the add token method
27:52
and here we will pass our user info
27:55
endpoint
27:57
after this. So user info now
28:02
user info response
28:06
and here we will simply request
28:10
dot get and here basically we will pass
28:13
the URI
28:15
we will pass the headers and the body
28:18
basically it's a get method not a post
28:19
one so headers we need to pass the
28:22
headers
28:27
and the next property is the data
28:29
property. So data is equal to body
28:34
and after this guys we just need to
28:36
print this information basically user
28:39
info
28:42
response that you get we can convert
28:44
this into JSON. So this will be the
28:46
information such as the profile picture
28:49
name and the email. So now we just need
28:52
to display this information guys. So for
28:54
displaying it we will have a if
28:56
condition user info dot response JSON
29:00
and if it contains a property which is
29:04
email verified in that case we can
29:07
display this information
29:10
and we can fetch the information guys
29:12
first is the ID of the user. So this is
29:15
present inside user info response JSON
29:20
and inside this property sub.
29:24
And similarly we will have for the email
29:27
as well.
29:35
Users email.
29:44
Next one for the picture profile picture
29:51
and this will be under picture
29:54
and next one will be the for the user
29:57
name username.
30:02
So again user uh response JSON and the
30:06
key here is given name.
30:10
That's it. So if the uh user is not
30:14
authenticated, if the uh email is not
30:16
verified, in that case guys, we will
30:18
simply say to the user that
30:21
user email not available
30:26
or not verified
30:30
by Google and 400 error we will say. And
30:35
now we just need to insert this user
30:36
inside our SQLite database guys. So we
30:39
will simply say create a new user of the
30:42
class user
30:44
and here we will pass the ID
30:48
underscore is equal to the unique ID
30:50
which is generated. We will pass the
30:53
name as user's name.
30:56
We will pass the email which is equal to
30:59
the user's email.
31:02
And lastly we will pass the profile
31:04
picture which is the picture. That's it.
31:10
So that's all guys we just need to
31:15
add this. So basically here we will have
31:18
if condition if not user dot get we will
31:21
first of all get the user by the unique
31:24
ID we will pass.
31:26
If the user is not present then we will
31:28
simply create the user user.create
31:30
create and we will pass this
31:32
information,
31:35
user's name,
31:38
user's email and picture.
31:43
And after this guys, you will start the
31:46
session by calling login user
31:51
and simply user like this.
31:55
And then we will simply redirect back to
31:57
the homepage. So redirect redirect
32:00
and here we will use URL for and simply
32:03
redirect to the index page. So here we
32:05
will call index like this.
32:08
So now we just need to move to the index
32:11
page guys. So here we just need to
32:12
display the information. So in this if
32:15
block
32:17
so we just need to display this
32:18
information that you see on the screen.
32:23
So this can be a simple template guys.
32:25
So I can simply copy this code.
32:29
Simply copy this. You will get all this
32:31
source code in the description. You will
32:33
see this message. You are logged in with
32:35
this email address. This profile picture
32:39
and this you will see that. And now if I
32:43
load this application
32:48
[snorts] the application is started. Now
32:50
if I refresh it,
32:57
click on this.
32:59
So you will see basically it is saying
33:01
insecure transport error [clears throat]
33:04
and uh must utilize https.
33:07
So I think guys you need to set a
33:09
property that I mentioned you. This is
33:11
the property. I think I made a mistake
33:13
here. If you don't set this property,
33:15
you will get this error
33:18
that I am getting right here. So just
33:21
make sure that you set this before
33:25
o sorry this needs to be oath library.
33:28
Just make this change
33:31
and now you will not get this error.
33:38
Click on this. So you will see now it
33:41
will display this information guys. As
33:43
you will see this is a profile picture
33:45
coding seure logged in and the log out
33:48
button. So if I click this log out
33:50
button guys you need to first of all
33:52
write this endpoint.
33:54
So it's very simple
33:57
uh just write this endpoint for the
33:59
logout functionality.
34:01
It's very simple. We will simply write a
34:04
route app.t route for the logout. So
34:08
whenever person just press this log out
34:11
button we will dis uh make a log out
34:14
function here
34:17
and this contains a method guys log out
34:19
user we import it from the flask login
34:21
and then we will simply return to the
34:23
homepage redirect URL for index
34:29
you will see that simple three lines of
34:31
code that's it so now if I refresh it
34:36
so Now you will see that
34:43
Gmail login you will see that
34:48
click on log out you will be redirected
34:50
to the homepage. So once again you will
34:52
see that it's very simple guys this is
34:55
the full O2 Google login and logout
34:59
system that we developed from scratch
35:01
inside flask. All the source code is
35:04
given in the description of this video
35:05
guys in the blog post. Please hit that
35:07
like button, subscribe the channel and I
35:09
will be seeing you in the next
