We can test this out using curl commands in the Terminal. To test the token-based authentication flow, follow these steps:
- Open the Terminal and generate first a base64-encoded string of email and password of the user we will need to authenticate as. You can do so using the following command in the Terminal. Replace the email with the email of the user you created previously from the browser and password with the user's password:
$ echo -n 'ankur@email.com:password' | openssl base64
- Running the preceding command will generate a base64-encoded version of the username and password, and now we will use this to get the token from our Vapor server by making a POST request to /tokens and pass the username ...