
Join the Conversation!
Subscribing gives you access to the comments so you can share your ideas, ask questions, and connect with others.
"Please login to view comments"
Subscribing gives you access to the comments so you can share your ideas, ask questions, and connect with others.
Complete source code available till this point of lesson is available at
How did you manage to remove the blur property and reach here?
Upgrading gives you access to quizzes so you can test your knowledge, track progress, and improve your skills.
By logging in, you'll unlock full access to this and other free tutorials on JSM Pro.
Why? Logging in lets us personalize your learning experience, track your progress, and keep you in the loop with new workshops, coding tips, and platform updates.
You'll also be the first to know about upcoming launches, events, and exclusive discounts.
No spam—just helpful content to level up your skills.
If that sounds fair, go ahead and log in to continue →
Enter your name and email to get instant access
##Looks like we found a thief monkey By the way, I liked the trick how you reached till here. You have a good sense of humor. You will improve a lot if you join our course with this passion.
var
(function-scoped, outdated)let
(block-scoped, modern and recommended)const
(block-scoped, cannot be reassigned)_
, or $
let let = 5;
is invalid)myVar
and myvar
are different)string
, number
, boolean
, null
, undefined
, bigint
, symbol
Objects
, Arrays
, Functions
Subscribing gives you access to a brief, insightful summary of each lecture to stay on track.
00:00:02 Hey, hey, remember when I told you that sometimes we might need to fetch users based on something else other than an ID,
00:00:09 like based on email?
00:00:11 Well, a similar situation will happen with accounts.
00:00:15 Sometimes we might need to fetch an account, not by the account ID, but rather by its provider, like Google, GitHub, or something else.
00:00:24 So for that reason, let's create a new folder called provider.
00:00:30 And within it, create a new route.ts that allow us to fetch it based on the provider.
00:00:37 We can copy what we had in the user email.
00:00:40 Now we'll change it to accommodate account provider.
00:00:44 First, instead of getting the email through the JSON body, we'll get the provider.
00:00:50 account ID.
00:00:52 In this case, instead of email within JSON body, we'll get the provider account ID.
00:00:59 And we have to pass it in those two additional places where we have red squiggly lines here and here.
00:01:06 Next, we'll validate the data by referencing it with the account schema, not the user schema.
00:01:13 We'll save parse it and pass in the provider account ID.
00:01:17 If it's not successful, we throw in a validation error.
00:01:21 After that, we try to fetch the account by saying account.find1 based on the provider account ID.
00:01:30 If there is no account, then we return not found account.
00:01:34 But if there is one, we can finally return it instead of returning the user.
00:01:39 And let's remove the unused imports.
00:01:42 And that's it.
00:01:43 The last API route for user authentication is now complete.
00:01:48 Now I can go ahead and push it to GitHub by saying, implement account by provider, commit and push.
00:01:56 And very, very soon we'll be able to call all of these API routes from the front end.
00:02:03 Great job for bearing with me and typing out all of this backend code and not seeing a browser in such a long time, but trust me,
00:02:10 it's coming very, very soon.