Authentication

You'll need to authenticate your requests to access any of the endpoints in the API. In this guide, we'll look at how authentication works. Protocol offers a way to authenticate your API requests by OAuth2 with a token

Basic authentication

To get a bearer token, you need to send a POST request to the /auth/login endpoint with your email and password. Here's an example using cURL:

Example request with basic auth

curl https://api.thefashionpeople.com/v1/auth/login \
  -d email="example@gmail.com" \
  -d password="password"

Please don't commit your password to GitHub!

OAuth2 with bearer token

The recommended way to authenticate with the API is by using OAuth2. When establishing a connection using OAuth2, you will need your access token — the one you received after login. Here's how to add the token to the request header using cURL:

Example request with bearer token

curl https://api.thefashionpeople.com/v1/users \
  -H "Authorization: Bearer {token}"

Always keep your token safe and reset it if you suspect it has been compromised.