Hi Rahul,
Indeed the 502 indicates your issue is not with authentication. So please find out why it breaks. Did you try just “docker login testnexusrepo.xxx.com” without any other client settings?
Note: HTTPS is implied by default, no need to set this on login.