Now that is it for this module.
You could enhance this application
by handling errors and giving the user more feedback.
But that would all be standard React,
there's nothing authentication specific about that.
It's just standard React
as we used it over and over throughout this course.
In this module,
I wanted to focus on the authentication specific parts,
how you can protect routes and pages,
how you can create users, log users in, log users out,
and check their authentication status.
And that's what we did in this module.
Now there's only one last thing left.
One last to do.
And that's this warning, which we're getting here,
that the NextAuth url environment variable is not set.
We can learn in the official NextAuth Docs
that this is an environment variable
which you should set when deploying for production.
Now, I did show you how you can set environment variables
for development and production
in the deployment course section.
And you can apply what you learned there
to add an environment variable of that name,
and then set it to the domain under which
you're going to host your application in production.
And that's important.
We're only talking about production here.
For development, you don't need to do that.
You can, of course, also inject that value
for this environment variable through your hosting provider.
For example, when using Vercel,
which we used in the deployment section, there you also had
environment variables part in your dashboard
where you could set environment variables and their values.
And there you could also set this environment variable
to your actual domain,
your actual url that leads to your website.
So that is something you want to add
when deploying your application that uses authentication.
But with that, we're done,
and you now learn how authentication works with Next.js,
and how it helps you with authentication.
And how you can manage users, creating users,
logging users in, protecting pages and routes,
changing the UI when users are logging in and logging out,
and how you can also protect your API routes.
Now it is worth noting that there are more providers
than the Credentials provider we used.
This is the provider where you manage your own users
with email, password, or whatever your credentials are.
You can also use a third party provider
like Apple or Amazon or GitHub or Facebook.
All of that is possible as well.
You can bring those providers as well,
and if you want to add
this kind of authentication to your application,
simply check out the NextAuth Docs
for that provider you want to use.
And you then learn
how you can add that provider to your application.
And providers in this NextAuth file which you always need,
providers is an array,
so you can always add multiple providers to your application
so that you can offer
multiple log in alternatives to your users.
So NextAuth is very powerful and flexible,
and in this module, you'll learn how you can use it.