A third party application can only access data of an installation after the farmer has given its permission. If the farmer gives permission your application will receive a token that will allow it to authenticate to the Nedap Livestock Connect API. Each time you make an API call you need to present this token as a proof of permission.
For this authorization and authentication process, we make use of the standard OAuth2 authorization protocol. More information about the OAuth2 authorization protocol can be found here.
From your own software, you must then redirect the farmer to the constructed URL. This can be done for example by offering a button in your software, with a text similar to ‘Link Nedap data’. This will navigate the farmer to the URL, which presents a login screen for Nedap Business Insight, where they can login with their account and authorize your software application
-d 'client_secret=b0147b284a' \
-d 'redirect_uri=https://my_application.com/access_code' \
-d 'code=aecd3e40cd' \
-d 'grant_type=authorization_code' \
Successful authorization response:
If you ever wish to revoke a token, this can be done with the following call:
-F client_secret=0d74dkfi3 \
-F token=aecd3e40cd \
-X POST https://nedap-bi.com/oauth/revoke
The above process provides you with the access token necessary to communicate with the Nedap API. However, it is only valid for 24 hours, and needs to be refreshed after that. It is not necessary to go through all the above steps again after this, The refresh token can be used for this purpose. Therefore, it is advised to store both the token and refresh token in your software. Refer to Authentication for more information.