Authentication
How to authenticate to our API.
Last updated
Was this helpful?
How to authenticate to our API.
Last updated
Was this helpful?
To start using the API you need 3 main things:
Email address for the vendor
The password vendor
JWT (JSON Web Token) Key
Using the email & password to generate the JWT Key, by calling the Authorization method. It will return a lot of JSON formatted data, for now we just need the JWT Key, which looks something like this:
{
"status":true,
"message":"Vendor autorization successfully.",
"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZW5kb3JfaWQiOiI0MyIsInVzZXJfaWQiOiI0MCIsInVzZXJfdHlwZSI6InZlbmRvciIsImVtYWlsIjoiemF6YUB1aWd0Yy5jb20iLCJpYXQiOjE2MjExNTc4NjcsImV4cCI6MTYyNjM0MTg2N30.H48knQdwQugrYDOCQW_flHmUZzRVNceiFM9OK8yWKq4",
"expires_in":1626341867,
"user_info":{......
You guessed it, the key that we need is in line #4 called "access_token". This key will be used in most of our API calls.
Once you got it all, look at this:
curl --request POST \
--url https://sandbox.mnasati.com/v1/customer \
--header 'Authorization-Jwt: ' \
--header 'Content-Type: ' \
--data '{"name":"john","country_id":1,"email":"johnd@gmail.com","phone":"966441424","password":"1234@#$%%","confirm_password":"1234@#$%%"}'
This method call above is to test the creation of a customer on your own store, just to validate that the authorization process is completed successfully.