Setting up Authentication
Intro

Authentication with the MakeLeaps app via our API is a quick and easy two-step process.

We make use of OAuth2 to authenticate API users, which is as simple as retrieving a token and passing it via the Authorization header in your following requests to MakeLeaps.

*New Bearer Tokens can be requested at any time and any amount of times, so there is no need to save them, infact, for security reasons we recommend against it.

Step 1: Send POST Request to Server

Retrieve an access token by sending a POST request to https://api.makeleaps.com/user/oath2/token/.

The request should have a valid Authorization header in the form Basic "<your_client_id>:< your_client_secret>" with your credentials base64 encoded and "{ "grant_type": "client_credentials" }" in the POST body.

Python
HTTP
url = 'https://api.makeleaps.com/user/oauth2/token/'

creds = '{self.client_id}:{self.client_secret}'.encode('utf-8')
creds_encoded = base64.b64encode(creds).decode('utf-8')

headers = {'Authorization': 'Basic {creds_encoded}'}
data = {'grant_type': 'client_credentials'}

response = requests.post(url, data=data, headers=headers)
POST /user/oauth2/token/ HTTP/1.1
Host: api.makeleaps.com
User-Agent: python-requests/2.21.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX==
Content-Length: 29
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials
Step 2: Retrieve token from response

Retrieve the Bearer token from the server’s response.

The server’s response will contain this object containing the token’s information:

HTTP
{"access_token": "XXXXXXXX", "token_type": "Bearer", "expires_in": 36000, "scope": "read write"}
Step 3: Pass token to Auth header

Pass the Bearer token in the Authorization header in future requests preceded by “Bearer” to authorize them.

HTTP
'Authorization': 'Bearer <access_token>'