00:05
For this series, we're going to be taking
00:06
a pre-existing AdonisJS web application
00:08
and adding an API on top of it.
00:10
Now, that API that we're going to be using
00:12
is the one that we built inside of our building
00:13
with AdonisJS and Inertia series,
00:16
but that series in itself is not a prerequisite
00:19
for this series here.
00:20
We're going to be picking up and kind of going over
00:23
the brief details that you need to know
00:24
in order to actually continue with this series
00:27
to get us up and running with the actual application
00:29
that we're going to be using.
00:30
Within the application itself,
00:32
this is really the only page that we're going to be altering.
00:35
This is the organization settings page.
00:37
And really, all that we're going to be doing
00:39
is adding a brand new section onto this
00:41
to manage our organization's access tokens.
00:43
The web application itself actually authenticates
00:46
with a user using an email and password,
00:49
but our API is going to instead authenticate
00:52
with access tokens against our organization itself.
00:56
So we're going to be able to add an access token
00:58
directly against our organization.
01:00
We're going to be able to give this access token a name
01:02
so that we have a way to identify it.
01:04
I'll just call this one test.
01:05
And then we can also specify some vague permissions here as well,
01:08
like whether or not we want this token to be able to read,
01:10
create records, update records, and delete records.
01:13
And we can select whichever of those we deem applicable
01:16
for the particular access token that we're creating.
01:18
Then we can create that access token,
01:20
and it's going to show it to us this one and only time
01:23
where we'll be able to copy it to our clipboard,
01:25
say, "Okay, I got my token."
01:27
And now we have an access token ready to use
01:30
that will give us read access to anything bound to this organization.
01:34
So this panel right here is really the only thing
01:36
that we're going to be touching with the web application portion
01:39
of this application.
01:39
Everything else that we're going to be doing in this series
01:41
is bound to adding an API on top of this application itself.
01:45
So for example, if we take our now copied access token,
01:48
hop over into an API client,
01:50
here I'm using an application called Hopscotch,
01:53
add a get request pointing to our application's local host domain,
01:57
and here I have it pointing to an API version one organization endpoint.
02:01
If we try to hit this without specifying our access token,
02:04
we're going to get an unauthorized access error.
02:07
If we come into our headers, add in an authorization header
02:11
with that bearer token that we've copied,
02:13
try sending this one more time,
02:15
we're going to get back our organization's details,
02:17
including its access levels, difficulties,
02:21
and statuses bound to it.
02:23
Now, of course, there are a couple of things
02:24
that you're going to need to know if you're not coming from our building
02:26
with AdonisJS and Inertia series about this application
02:30
in order to successfully pick up and go from here.
02:33
So we'll take the next couple of lessons to cover what those are.
02:36
Those are going to include actually pulling down
02:38
the repository itself from GitHub,
02:39
what the application itself looks like,
02:43
and what our database schema looks like as well.
Join The Discussion! (0 Comments)
Please sign in or sign up for free to join in on the dicussion.
Be the first to Comment!