In this process you will use the values retrieved in the previous steps, to generate a refresh token. The refresh token is required when setting up the connection on Hunters.
To generate a refresh token:
Open your terminal and run the following command after replacing the {client_id}, {client_secret} and {authorization_code} variables with the information collected in the previous steps:
curl -X POST \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "code=AUTHORIZATION_CODE" \ -d "client_id=CLIENT_ID" \ -d "client_secret=CLIENT_SECRET" \ -d "redirect_uri=http://localhost:5110" \ -d "grant_type=authorization_code" \ https://login.microsoftonline.com/common/oauth2/token
Invoke-RestMethod -Uri "https://login.windows.net/common/oauth2/token" -Method Post -Headers @{"Content-Type"="application/x-www-form-urlencoded"} -Body "client_id={client_id}&client_secret={client_secret}&redirect_uri=http://localhost:5110&grant_type=authorization_code&code={authorization_code}"
An access token and a refresh token will be returned.Copy and paste both values into a notepad for future use:
Access token - use it in the next steps to start subscriptions (if required).
Refresh token - use it when setting up the connection on the Hunters platform.