code: func checkAuth(client *Client) (bool, error) {
  	_, response, err := client.Accounts.GetAccount("self")
  	switch err {
  	case ErrWWWAuthenticateHeaderMissing:
  		return false, nil
  	case ErrWWWAuthenticateHeaderNotDigest:
  		return false, nil
  	default:
  		// Response could be nil if the connection outright failed
  		// or some other error occurred before we got a response.
  		if response == nil && err != nil {
  			return false, err
  		}
  
  		if err != nil && response.StatusCode == http.StatusUnauthorized {
  			err = nil
  		}
  		return response.StatusCode == http.StatusOK, err
  	}
  }
docs: // checkAuth is used by NewClient to check if the current credentials are
  // valid. If the response is 401 Unauthorized then the error will be discarded.