Authentication API

You can access the token via authentication in API using username and password. (edited) 

Documentation

  • Endpoint: POST /api/v2/users/sign_in

  • Authentication: Not required

  • Request Body Format: x-www-form-urlencoded

  • Body

    • user[email] (string, required): The email address of the user.

    • user[password] (string, required): The password associated with the user's account.

  • Response Format: JSON

  • Response Attributes

    • user_id (integer): The unique identifier for the user.

    • email (string): The email address of the authenticated user.

    • authentication_token (string): The long-lived authentication token used for subsequent authenticated requests.

Example response

{ "user_id": 1, "email": "user@example.com", "authentication_token": "<long token>" }

 


Using API with curl

 

cURL Request to authenticate:

curl -X POST -d user[email]="user@example.com" -d user[password]="pwd" https://staging.makerble.com/api/v2/users/sign_in
Response:
{"user_id": 1, "email": "user@example.com", "authentication_token": "<long token>"}

cURL request to access api
curl --header "X-User-Token: <long token>" --header "X-User-Email: user@example.com" https://staging.makerble.com/api/v2/beneficiary_categories

Related information

  • If you want activity to be recorded about multiple users (as though they were individual users on the web platform) you should build API interactions with every user rather than only having API interactions go via an Organisation Admin user.

  • However if the integration that you are building does not require that actions be attributed to specific users, you could instead only build API interactions with a single Organisation Admin user

  • There is no expiry of each authentication token. Each user has a fixed token.