Curl refresh token

I’m doing automation with google sheets and I need to return a refresh token, but I don’t know how.
Has anyone ever experienced this?

curl https://www.googleapis.com/oauth2/v4/token
-d client_id=xxxxxx
-d client_secret=xxxxx
-d refresh_token=xxxx
-d grant_type=refresh_token

In a test done in this online curl it worked, but I couldn’t implement it in Ha