We've got our signing room put together and now we're ready to test it out before we flip over to post
man and do anything.
I'm going to first go back over to my Mongo DB console.
Remember back over here we selected our cluster.
We then took a look at our different collections and we inspected our list of users.
So once again right now I've got just one user inside of my database and then password of that user
is still a plain text password.
I don't want to have any plaintext passwords in my database whatsoever especially while I'm testing
because if I tried to sign in with this user because this password is not salted or hash Well I'm always
going to fail that comparison and I'm never going to be able to log in as this user again so I'm going
to delete them very quickly by hovering over that user and then going to the delete icon on the far
right hand side.
I'll then click on delete and I'll wait just a second to make sure that actually was deleted.
I'm going to click find once again and I'm just going to verify that I don't have any users inside of
here.
OK.
Let's now flip back over to postmen.
And we're ready to actually test this stuff out.
So I got to make sure that I make a post request to my sign up route because I need to have some existing
user inside my database.
I'm going to once again sign up with an email of test one at test dot com.
Any password of my password.
So I'm going to send that request off.
It looks like I successfully signed up.
There's my Jason web token right there.
And if I flip back over to my Mongo DB collection I can once again tap on find an LLC that I've got
once again one user.
There's my email and now the password is successfully salted and hashed.
So no longer is it a plain text password.
So now that we've created this user we can now attempt to log in as that.
So to log in as that user we can go back over to a post man.
I'm going to change my roots up here from sign up to sign in because now I want to sign in as this person
if I successfully sign in then I should once again get back a Jason web token that essentially authenticates
me as this person I got to make sure I've got the same email and the same password I'll hit send.
And sure enough I get another Jason web token.
So my server has said OK sounds good.
You supplied the correct password and the email of a valid user.
So here's a Jason web token that proves that you are who you say you are.
If I want to make sure that this sign in route really works we should attempt to a failed signing in
as well so I could change my password.
Maybe I'll put in a password of like just whatever if I now try to sign in I'm gonna get an error message
that says invalid password or email and I can try putting in a random email as well.
So like some random e-mail that doesn't actually exist inside my database if I send that yep I get the
same error message.
And then finally if I do not provide an email or a password altogether I should get some kind of appropriate
air so must provide email and password.
Very good.
So I think that we've got all these different cases handled successfully so we can now successfully
sign up and sign into our application and anytime we do either we get back this Jason web token that
proves that we are this given user.
So this is looking pretty good.
So let's take another quick pause right here when we continue on the next video we're going to start
integrating in this idea of having our API manage all of the different tracks that get created by a
user inside of our application.
So let's take care of that in the next video.