Skip to content

Commit faf3256

Browse files
committed
Cleaning up README.md
1 parent 7f80367 commit faf3256

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

README.md

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# JWT Authentication for the WP REST API
22

3-
A simple plugin to add [JSON Web Token (JWT)](https://tools.ietf.org/html/rfc7519) Authentication to WP REST API.
3+
A simple plugin to add [JSON Web Token (JWT)](https://tools.ietf.org/html/rfc7519) Authentication to the WP REST API.
44

5-
To know more about the JSON Web Tokens, please visit [http://jwt.io](http://jwt.io).
5+
To know more about JSON Web Tokens, please visit [http://jwt.io](http://jwt.io).
66

77
## Requirements
88

@@ -16,13 +16,13 @@ So, to use the **wp-api-jwt-auth** you need to install and activate [WP REST API
1616

1717
**Minimum PHP version: 5.3.0**
1818

19-
### PHP HTTP Authorization Header enable
19+
### Eable PHP HTTP Authorization Header
2020

21-
#### Shared Hostings
21+
#### Shared Hosts
2222

23-
Most of the shared hosting has disabled the **HTTP Authorization Header** by default.
23+
Most of the shared hosts have disabled the **HTTP Authorization Header** by default.
2424

25-
To enable this option you'll need to edit your **.htaccess** file adding the follow
25+
To enable this option you'll need to edit your **.htaccess** file by adding the following:
2626

2727
```
2828
RewriteEngine on
@@ -32,25 +32,23 @@ RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
3232

3333
#### WPEngine
3434

35-
To enable this option you'll need to edit your **.htaccess** file adding the follow
36-
37-
See https://github.com/Tmeister/wp-api-jwt-auth/issues/1
35+
To enable this option you'll need to edit your **.htaccess** file by adding the following (see https://github.com/Tmeister/wp-api-jwt-auth/issues/1):
3836

3937
```
4038
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
4139
```
4240

4341
## Installation & Configuration
4442

45-
[Download the zip file](https://github.com/Tmeister/wp-api-jwt-auth/archive/master.zip) and install it as any other WordPress plugin.
43+
[Download the zip file](https://github.com/Tmeister/wp-api-jwt-auth/archive/master.zip) and install it like any other WordPress plugin.
4644

47-
Or clone this repo into your WordPress installation under the wp-content/plugins folder.
45+
Or clone this repo into your WordPress installation into the wp-content/plugins folder.
4846

4947
### Configurate the Secret Key
5048

51-
The JWT needs a **secret key** to sign the token this **secret key** must be unique and never revealed.
49+
The JWT needs a **secret key** to sign the token. This **secret key** must be unique and never revealed.
5250

53-
To add the **secret key** edit your wp-config.php file and add a new constant called **JWT_AUTH_SECRET_KEY**
51+
To add the **secret key**, edit your wp-config.php file and add a new constant called **JWT_AUTH_SECRET_KEY**.
5452

5553

5654
```php
@@ -71,19 +69,19 @@ define('JWT_AUTH_CORS_ENABLE', true);
7169
```
7270

7371

74-
Finally activate the plugin within your wp-admin.
72+
Finally activate the plugin within the plugin dashboard.
7573

7674
## Namespace and Endpoints
7775

78-
When the plugin is activated, a new namespace is added
76+
When the plugin is activated, a new namespace is added.
7977

8078

8179
```
8280
/jwt-auth/v1
8381
```
8482

8583

86-
Also, two new endpoints are added to this namespace
84+
Also, two new endpoints are added to this namespace.
8785

8886

8987
Endpoint | HTTP Verb
@@ -129,7 +127,7 @@ Validates the user credentials, *username* and *password*, and returns a token t
129127

130128
```
131129

132-
Success response from the server
130+
Success response from the server:
133131

134132
```json
135133
{
@@ -140,7 +138,7 @@ Success response from the server
140138
}
141139
```
142140

143-
Error response from the server
141+
Error response from the server:
144142

145143
```json
146144
{
@@ -152,11 +150,11 @@ Error response from the server
152150
}
153151
```
154152

155-
Once you get the token, you must store it somewhere in your application, ex. in a **cookie** or using **localstorage**.
153+
Once you get the token, you must store it somewhere in your application, e.g. in a **cookie** or using **localstorage**.
156154

157-
From this point, you should pass this token to every API call
155+
From this point, you should pass this token to every API call.
158156

159-
Sample call using the Authorization header using AngularJS
157+
Sample call using the Authorization header using AngularJS:
160158

161159
```javascript
162160
app.config( function( $httpProvider ) {
@@ -178,7 +176,7 @@ app.config( function( $httpProvider ) {
178176
} );
179177
```
180178

181-
The **wp-api-jwt-auth** will intercept every call to the server and will look for the Authorization Header, if the Authorization header is present will try to decode the token and will set the user according with the data stored in it.
179+
The **wp-api-jwt-auth** will intercept every call to the server and will look for the authorization header, if the authorization header is present, it will try to decode the token and will set the user according with the data stored in it.
182180

183181
If the token is valid, the API call flow will continue as always.
184182

@@ -192,7 +190,7 @@ Authorization: Bearer mF_s9.B5f-4.1JqM
192190

193191
###Errors
194192

195-
If the token is invalid an error will be returned, here are some samples of errors.
193+
If the token is invalid an error will be returned. Here are some samples of errors:
196194

197195
**Invalid Credentials**
198196

@@ -240,7 +238,7 @@ If the token is invalid an error will be returned, here are some samples of erro
240238

241239
This is a simple helper endpoint to validate a token; you only will need to make a POST request sending the Authorization header.
242240

243-
Valid Token Response
241+
Valid Token Response:
244242

245243
```json
246244
{
@@ -289,7 +287,7 @@ time() + (DAY_IN_SECONDS * 7)
289287

290288
The **jwt_auth_token_before_sign** allows you to modify all the token data before to be encoded and signed.
291289

292-
Default Value
290+
Default value:
293291

294292
```php
295293
<?php
@@ -309,7 +307,7 @@ $token = array(
309307
###jwt_auth_token_before_dispatch
310308
The **jwt_auth_token_before_dispatch** allows you to modify all the response array before to dispatch it to the client.
311309

312-
Default Value:
310+
Default value:
313311

314312
```php
315313
<?php
@@ -326,5 +324,5 @@ $data = array(
326324

327325
[PHP-JWT from firebase](https://github.com/firebase/php-jwt)
328326

329-
##Licence
327+
##License
330328
[GPLv2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)

0 commit comments

Comments
 (0)