So let's start with the most important question.
What exactly is authentication? What does this term mean?
Well, as mentioned before in the
last lecture on some websites,
I would say on many websites, actually,
you have certain areas on the website that should not be
accessible by everyone. For example,
if you are building a social network site,
then you of course need to give users a off creating
profiles so that they can use your site.
If you're building an online shop,
then people need to be able to log in to access their
shopping cart, maybe, or most importantly,
to access their past orders or place a new order.
Or even if you're just building a blog,
then visitors might not need an account,
but the administrator, the owner of the
blog probably should also have some kind of account,
which grants exclusive access to the administration area
where new block posts can be created.
And existing blog posts can be managed.
Not every user should be able to add
it or delete or create blog posts.
And for example, in the example, blog website,
we built before in this course, that was the case There,
Every user was able to do everything that was no problem.
Back then in the course, because the focus of those
course sections was to learn how to incorporate a database.
We did not build a finished website there. It was
just a demo website, but if you would be building
a real blog, then of course you would
want to lock down access to certain
features and you would want to ensure that
not every user is able to do everything.
So therefore these are areas where you want authentication
to lock down certain aspects or areas off your website and
only grant access to authenticated users.
So only grant access to users who do have an account.
So how do you then implement authentication?
Well, you can roughly split it into
three main steps. The first step of course,
is that you need to give your users a way of signing up of
creating an account. If you don't have an account,
you can't log in, they offer the next step.
Once you added to the user sign up functionality is that you
also add a log in functionality,
allowing users to use their account,
to then log in with their credentials.
So with the email and password today choose,
and then once users are logged in,
you wanna kind of keep track of them.
You wanna store the information that a certain user is
locked in so that you can then grant that user access to
certain protected pages in the future.
If you don't keep track of that,
then the login process alone won't be that helpful.
The user logs in and then tries to visit a protected page.
If you didn't store information
that the users should be granted,
access, access will be denied and the
user will still not be able to access that page.
So therefore storing that information that a certain user is
locked in now is also a crucial part and will be one of the
main parts of this course section, actually,
that is where we will soon dive into sessions and cookies
because those features will help us with keeping track of
the authentication status of a user.
But let's just get there. Step-by-step Shall we?
let's ignore steps two and free for now.
And let's start with step one user account creation and
adding such a signup functionality and
therefore allowing users to create accounts.