Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,070 --> 00:00:05,020
Now that is it for this module.
2
00:00:05,020 --> 00:00:07,380
You could enhance this application
3
00:00:07,380 --> 00:00:11,250
by handling errors and giving the user more feedback.
4
00:00:11,250 --> 00:00:13,910
But that would all be standard React,
5
00:00:13,910 --> 00:00:17,530
there's nothing authentication specific about that.
6
00:00:17,530 --> 00:00:19,370
It's just standard React
7
00:00:19,370 --> 00:00:22,200
as we used it over and over throughout this course.
8
00:00:22,200 --> 00:00:23,220
In this module,
9
00:00:23,220 --> 00:00:27,230
I wanted to focus on the authentication specific parts,
10
00:00:27,230 --> 00:00:30,380
how you can protect routes and pages,
11
00:00:30,380 --> 00:00:34,300
how you can create users, log users in, log users out,
12
00:00:34,300 --> 00:00:36,800
and check their authentication status.
13
00:00:36,800 --> 00:00:39,560
And that's what we did in this module.
14
00:00:39,560 --> 00:00:42,310
Now there's only one last thing left.
15
00:00:42,310 --> 00:00:43,750
One last to do.
16
00:00:43,750 --> 00:00:46,350
And that's this warning, which we're getting here,
17
00:00:46,350 --> 00:00:50,840
that the NextAuth url environment variable is not set.
18
00:00:50,840 --> 00:00:53,440
We can learn in the official NextAuth Docs
19
00:00:53,440 --> 00:00:55,270
that this is an environment variable
20
00:00:55,270 --> 00:00:58,980
which you should set when deploying for production.
21
00:00:58,980 --> 00:01:02,840
Now, I did show you how you can set environment variables
22
00:01:02,840 --> 00:01:05,300
for development and production
23
00:01:05,300 --> 00:01:08,320
in the deployment course section.
24
00:01:08,320 --> 00:01:10,360
And you can apply what you learned there
25
00:01:10,360 --> 00:01:13,070
to add an environment variable of that name,
26
00:01:13,070 --> 00:01:16,060
and then set it to the domain under which
27
00:01:16,060 --> 00:01:19,830
you're going to host your application in production.
28
00:01:19,830 --> 00:01:21,070
And that's important.
29
00:01:21,070 --> 00:01:23,380
We're only talking about production here.
30
00:01:23,380 --> 00:01:26,350
For development, you don't need to do that.
31
00:01:26,350 --> 00:01:29,250
You can, of course, also inject that value
32
00:01:29,250 --> 00:01:32,910
for this environment variable through your hosting provider.
33
00:01:32,910 --> 00:01:35,060
For example, when using Vercel,
34
00:01:35,060 --> 00:01:39,220
which we used in the deployment section, there you also had
35
00:01:39,220 --> 00:01:42,020
environment variables part in your dashboard
36
00:01:42,020 --> 00:01:45,950
where you could set environment variables and their values.
37
00:01:45,950 --> 00:01:49,020
And there you could also set this environment variable
38
00:01:49,020 --> 00:01:50,980
to your actual domain,
39
00:01:50,980 --> 00:01:54,453
your actual url that leads to your website.
40
00:01:55,660 --> 00:01:57,530
So that is something you want to add
41
00:01:57,530 --> 00:02:01,300
when deploying your application that uses authentication.
42
00:02:01,300 --> 00:02:03,310
But with that, we're done,
43
00:02:03,310 --> 00:02:07,210
and you now learn how authentication works with Next.js,
44
00:02:07,210 --> 00:02:09,979
and how it helps you with authentication.
45
00:02:09,979 --> 00:02:12,810
And how you can manage users, creating users,
46
00:02:12,810 --> 00:02:15,930
logging users in, protecting pages and routes,
47
00:02:15,930 --> 00:02:19,550
changing the UI when users are logging in and logging out,
48
00:02:19,550 --> 00:02:22,853
and how you can also protect your API routes.
49
00:02:23,710 --> 00:02:27,350
Now it is worth noting that there are more providers
50
00:02:27,350 --> 00:02:30,530
than the Credentials provider we used.
51
00:02:30,530 --> 00:02:33,960
This is the provider where you manage your own users
52
00:02:33,960 --> 00:02:38,260
with email, password, or whatever your credentials are.
53
00:02:38,260 --> 00:02:40,720
You can also use a third party provider
54
00:02:40,720 --> 00:02:45,720
like Apple or Amazon or GitHub or Facebook.
55
00:02:46,780 --> 00:02:48,880
All of that is possible as well.
56
00:02:48,880 --> 00:02:50,960
You can bring those providers as well,
57
00:02:50,960 --> 00:02:52,280
and if you want to add
58
00:02:52,280 --> 00:02:55,340
this kind of authentication to your application,
59
00:02:55,340 --> 00:02:57,930
simply check out the NextAuth Docs
60
00:02:57,930 --> 00:03:00,090
for that provider you want to use.
61
00:03:00,090 --> 00:03:01,320
And you then learn
62
00:03:01,320 --> 00:03:05,830
how you can add that provider to your application.
63
00:03:05,830 --> 00:03:10,260
And providers in this NextAuth file which you always need,
64
00:03:10,260 --> 00:03:11,880
providers is an array,
65
00:03:11,880 --> 00:03:16,200
so you can always add multiple providers to your application
66
00:03:16,200 --> 00:03:17,370
so that you can offer
67
00:03:17,370 --> 00:03:21,470
multiple log in alternatives to your users.
68
00:03:21,470 --> 00:03:24,760
So NextAuth is very powerful and flexible,
69
00:03:24,760 --> 00:03:27,593
and in this module, you'll learn how you can use it.
5564
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.