###Instructions
-
Clone the project
-
In terminal, run
sails lift
-
Register a “Client”
-
Post request to
http://localhost:1336/clients/register
withx-www-form-urlencoded
key:value pairs:email : <your email>
-
Expected response:
{ "url": "http://localhost:1336/clients/verify/<your email>?code=gqjH6igH6Z89ROEoVRFmEiVYuEfEZ1kQ" }
-
Access the verification link. Expected result:
{ "verified": true, "email": "<your email>" }
-
-
Register a User
-
Post Request to
http://localhost:1336/users/register
withx-www-form-urlencoded
key:value pairs:username : <your username> password : <your password> email : <your email>
-
Expected result:
{ "url": "http://localhost:1336/users/verify/<your email>?code=Y087VfF3bbHmNrQaRsAfOB8srfNB0gDW" }
-
Access the verification link. Expected result:
{ "verified": true, "email": "<your email>" }
-
-
Request Token
-
In order to request a token, you require a registered client and a registered user.
-
Post request to
http://localhost:1336/oauth/token
withx-www-form-urlencoded
key:value pairs:grant_type : password client_id : <received client id> username : <your username> password : <your password>
-
Copy access_token value (
<received access token>
) from the expected result:{ "access_token": "<received access token>", "refresh_token": "<received refresh token>", "expires_in": 3600, "token_type": "Bearer" }
-
-
Request Resource with Token
-
Request with GET
http://localhost:1336/users/current
with custom authorization header key:value pair:Authorization : Bearer <received access token>
-
Expected result:
{ "identity": { "username": "<your username>", "email": "<your email>" } }
-
If you get the result as in stept 5, it means that the project runs successfully. Congrats.