Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,050 --> 00:00:03,930
As I mentioned in the last lecture,
2
00:00:03,930 --> 00:00:07,140
we don't need to build everything from scratch.
3
00:00:07,140 --> 00:00:10,860
Instead there is a package, the NextAuth package
4
00:00:10,860 --> 00:00:14,680
which we can use for implementing authentication.
5
00:00:14,680 --> 00:00:18,130
Now the NextAuth package makes adding authentication
6
00:00:18,130 --> 00:00:21,540
to your next application super, super simple.
7
00:00:21,540 --> 00:00:24,290
And it actually supports a broad variety
8
00:00:24,290 --> 00:00:27,310
of authentication for writers.
9
00:00:27,310 --> 00:00:30,390
So you can't just go with your own email
10
00:00:30,390 --> 00:00:32,119
and password combination.
11
00:00:32,119 --> 00:00:36,320
You can also easily add Sign In with Google or Facebook
12
00:00:36,320 --> 00:00:39,273
or Apple or whatever you want with NextAuth.
13
00:00:40,650 --> 00:00:43,410
The documentation of course is the place to go.
14
00:00:43,410 --> 00:00:46,600
And there, if you click on authentication providers
15
00:00:46,600 --> 00:00:49,180
you'll see a list of supported providers
16
00:00:49,180 --> 00:00:50,810
and if you click on one, you'll learn
17
00:00:50,810 --> 00:00:54,750
how to implement authentication with that provider.
18
00:00:54,750 --> 00:00:58,050
So that is something you absolutely can do.
19
00:00:58,050 --> 00:01:00,100
Now here in this module
20
00:01:00,100 --> 00:01:03,030
we will not use one of those providers though
21
00:01:03,030 --> 00:01:05,610
but instead we will build it from scratch
22
00:01:05,610 --> 00:01:08,470
with our own email password combination
23
00:01:08,470 --> 00:01:12,160
stored in our own database so that we can really see
24
00:01:12,160 --> 00:01:17,160
the complete authentication flow in greatest detail.
25
00:01:17,450 --> 00:01:20,400
Now therefore that is the package we are going to use
26
00:01:20,400 --> 00:01:22,330
and hence to get started,
27
00:01:22,330 --> 00:01:26,320
what we'll do is we'll first of all install NextAuth.
28
00:01:26,320 --> 00:01:27,283
So in our project folder,
29
00:01:27,283 --> 00:01:32,010
or quits to dev server and NPM, install NextAuth.
30
00:01:32,010 --> 00:01:36,370
To install this NextAuth package next to dash-auth.
31
00:01:36,370 --> 00:01:39,600
We'll install that and the NextAuth package
32
00:01:39,600 --> 00:01:44,250
has both server-side and client-side capabilities.
33
00:01:44,250 --> 00:01:47,540
We'll be able to use it on some API routes
34
00:01:47,540 --> 00:01:50,970
to verify if a user is logged in and we'll be able
35
00:01:50,970 --> 00:01:53,790
to use it in our components to do the same.
36
00:01:53,790 --> 00:01:56,340
Because of course the answer to the question
37
00:01:56,340 --> 00:01:58,100
whether a user is logged in
38
00:01:58,100 --> 00:02:02,960
and authenticated is not just needed on protected resources
39
00:02:02,960 --> 00:02:06,170
on the server-side, so in our API routes
40
00:02:06,170 --> 00:02:08,830
but also in our client-side components.
41
00:02:08,830 --> 00:02:13,450
There we also might want to show a different user interface
42
00:02:13,450 --> 00:02:17,180
based on whether a user is authenticated or not.
43
00:02:17,180 --> 00:02:20,270
And NextAuth will allow us to do both
44
00:02:20,270 --> 00:02:23,590
server-side and client-side validation.
45
00:02:23,590 --> 00:02:27,320
It will also help us with generating those Auth Tokens.
46
00:02:27,320 --> 00:02:29,820
Those JSON Web Tokens.
47
00:02:29,820 --> 00:02:31,950
One thing it will not do though
48
00:02:31,950 --> 00:02:35,520
is manage user creation for us.
49
00:02:35,520 --> 00:02:38,820
We need to bring our own logic for this.
50
00:02:38,820 --> 00:02:41,700
It does support various databases
51
00:02:41,700 --> 00:02:45,080
but mostly for other authentication methods.
52
00:02:45,080 --> 00:02:48,860
And when it comes to having our own user accounts
53
00:02:48,860 --> 00:02:49,693
then we need to bring our own
54
00:02:49,693 --> 00:02:54,605
signup API route and our own user verification logic.
55
00:02:56,520 --> 00:02:58,570
But that's exactly what we're going to build
56
00:02:58,570 --> 00:03:00,260
over the next lectures now
57
00:03:00,260 --> 00:03:02,160
and what we're going to explore there.
4616
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.