Skip to content

Commit b5e3c70

Browse files
authored
Fix chapter 4 typos (#64)
1 parent d10b2a7 commit b5e3c70

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rails6/en/chapter04-authentication.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $ git checkout -b chapter04
2323

2424
== Stateless session
2525

26-
Before we go any further, something must be clear: *an API does not handle sessions*. If you don't have experience building this kind of application, it might sound a little crazy but stay with me. An API should be stateless, which means by definition _is one that provides a response after your request and then requires no further attention._. This means no previous or future state is required for the system to work.
26+
Before we go any further, something must be clear: *an API does not handle sessions*. If you don't have experience building this kind of application, it might sound a little crazy but stay with me. An API should be stateless, which means by definition _is one that provides a response after your request and then requires no further attention_. This means no previous or future state is required for the system to work.
2727

2828
The flow for authenticating the user through an API is effortless:
2929

@@ -298,7 +298,7 @@ We will now implement the following logic: we'll find the corresponding user of
298298

299299
We will use the HTTP header `Authorization`, which is often used for this purpose. We may also use a GET parameter named `apiKey` but I prefer to use an HTTP header because it gives context to the request without polluting the URL with additional parameters.
300300

301-
We will therefore create a `current_user` method to meet our needs. It will find the user thanks his authentication token, which is sent on each request.
301+
We will therefore create a `current_user` method to meet our needs. It will find the user thanks to his authentication token, which is sent on each request.
302302

303303
When it comes to authentication, I like adding all the associated methods in a separate file. Then simply include the file in the `ApplicationController`. In this way, it's straightforward to test in isolation. Let's create the file in the `controllers/concerns` directory with a `current_user` method that we will implement right after:
304304

0 commit comments

Comments
 (0)