#!/bin/bash # Requirements: # - curl # - jq CLIENT_ID=your-client-id CLIENT_SECRET=your-client-secret USERNAME=publisher-username PASSWORD=publisher-password curl https://auth.avocarrot.com/token \ -X POST \ -d "client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&grant_type=password&username=$USERNAME&password=$PASSWORD" \ -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' > /tmp/access_token.json cat /tmp/access_token.json REFRESH_TOKEN=$(cat /tmp/access_token.json | jq -r '.refresh_token') curl https://auth.avocarrot.com/token \ -X POST \ -d "client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&grant_type=refresh_token&refresh_token=$REFRESH_TOKEN" \ -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' > /tmp/refresh_token.json ACCESS_TOKEN=$(cat /tmp/refresh_token.json | jq -r '.access_token') curl https://auth.avocarrot.com/users/me -H "Authorization: Bearer $ACCESS_TOKEN" | jq '.'