Error 521 indicates the any one of the following user actions needed
Examine the request and verify that at least one of the following parameter sets are present.
Username and password
Username, password, and device registration certificate
Probably, check the certificate at first and see the certificate is still valid