curl --request POST \
--url https://api.hubapi.com/oauth/v1/token \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'grant_type=authorization_code&code=<PUT CODE HERE>&redirect_uri=<PUT REDIRECT URI SAME AS mentioned in app>&client_id=<PUT CLIENT ID HERE>&client_secret=<PUT CLIENT SECRET HERE>'
Hope this will helps you out. Please mark it as Solution Accepted & Upvote to help other Community member.
Thanks!