Need example for how to login with curl using v2 docker registry api

We need to be able to tag images, it seems that we can do this using curl to download and upload a given manifest to a different location referenced by the tag we want to create. We need to authenticate in curl for this, do we use a Bearer Token? If so, how can we get one, we need an example? Or Do we simply use --user username:password https://… for every request? Do we use the URL to the repo, or the :port value used for docker login (also podman login)? Any help appreciated. I’d like to be able to tag Docker images remotely using Nexus as a registry. Thanks.

Hi!
I think this article might help you with your action via CURL: https://success.docker.com/article/how-do-i-authenticate-with-the-v2-api