This guide will walk you through obtaining a bearer token using the client credentials grant type in Postman
and then utilizing that token for authorized API requests for the AgroVision Pigs API.
Prerequisites:
- Postman: Ensure you have Postman installed.
- Authorization endpoint: https://login.agrovision.com/connect/token
- Client ID and Client Secret: You'll require a client ID and client secret provided by your AgroVision.
Configure the Authorization Request in Postman
1. Create a New Request:
- Open Postman and create a new request.
- Set the request method to
POST
. - Enter the URL to the resource you need to access (https://av-pi-sows-public-agw-app.azurewebsites.net).
2. Set the Authorization Type:
- Go to the "Authorization" tab.
- Select "OAuth 2.0" from the "Type" dropdown.
3. Configure OAuth 2.0:
- Scroll down to the "Configure New Token" section.
- Grant Type: Select "Client Credentials".
- Access Token URL: Input the token endpoint URL (authorization endpoint).
- Client ID: Enter your client ID.
- Client Secret: Enter your client secret.
- Client Authentication: Select "Send as Basic Auth header".
- Scope: "PigSows.API" or/and "Agrovision.Pigs.Public.API".
4. Set query parameters
You'll also need to add a query parameter in the request URL of the token request:
5. Get New Access Token:
- Click the "Get New Access Token" button.
- Postman will send the request to the token endpoint.
- If successful, you'll receive the access token, token type (Bearer), and other relevant information.
- Click "Use Token".