Fixing server registration to properly authenticate with the remote server.

(cherry picked from commit 83b77c7307ee10d9ac68ce7219066c6b2c302a8f)
Fixing server registration to properly authenticate with the remote server.

(cherry picked from commit 0e4c3d665a3d990449973c5c5ee576743138f01a)