WEBVTT
Kind: captions
Language: en

00:00:00.030 --> 00:00:08.519
Next let's test our login API in the
browser open up the terminal or git bash

00:00:08.519 --> 00:00:16.049
window and connect to our vagrant server
by typing vagrant SSH once you're

00:00:16.049 --> 00:00:22.800
connected type cd forward slash
vagrant and then type source tilde

00:00:22.800 --> 00:00:29.000
forward slash env slash bin slash activate

00:00:29.000 --> 00:00:31.890
to activate the virtual environment then

00:00:31.890 --> 00:00:38.540
start the Django management server by
typing Python manage dot py run server

00:00:38.540 --> 00:00:48.750
0.0.0.0 : 8000 hit enter and then open
up your browser and we're going to head

00:00:48.750 --> 00:00:56.670
over to 127.0.0.1 : 8000 forward slash
api

00:00:56.670 --> 00:01:03.960
forward slash login this is the login
api that we created in the previous

00:01:03.960 --> 00:01:10.979
video you can see that it has a username
and password input the username is the

00:01:10.979 --> 00:01:16.020
username field that we're going to be
using for authentication which is mapped

00:01:16.020 --> 00:01:22.020
to the email field so if we head over to
the atom editor and you open up the

00:01:22.020 --> 00:01:27.420
models dot py file in our profiles API
you can see that we set the username

00:01:27.420 --> 00:01:36.240
field to email now since we're using the
Django admin built-in authentication

00:01:36.240 --> 00:01:41.640
system it still calls the field username
there even though we mapped it to our

00:01:41.640 --> 00:01:44.310
email field but all you need to know is that the user

00:01:44.310 --> 00:01:50.460
name needs to be the identifier which is
the email that we use for the login so

00:01:50.460 --> 00:01:56.340
let's try and create an authentication
token with our login API I'm going to

00:01:56.340 --> 00:02:02.850
try with my mark@londonappdev.com
username and then I'm going to put the

00:02:02.850 --> 00:02:11.670
password as password 1 2 3 and then hit
post you can see that after I posted

00:02:11.670 --> 00:02:13.410
this I received

00:02:13.410 --> 00:02:19.680
a token which is my authentication token
that I can use to authenticate future

00:02:19.680 --> 00:02:26.850
requests to our API in a future video
I'm going to show you how to assign this

00:02:26.850 --> 00:02:33.630
token to the headers of a request so you
can authenticate an API request so

00:02:33.630 --> 00:02:40.170
that's how you test the API login
endpoint thank you for watching and I'll

00:02:40.170 --> 00:02:43.670
see you in the next video

