code: func Register(params RegisterParams) (*Identity, error) {
  	// Read in the token. The token can either be passed in or come from a file
  	// on disk.
  	token, err := readToken(params.Token)
  	if err != nil {
  		return nil, trace.Wrap(err)
  	}
  
  	// Attempt to register through the auth server, if it fails, try and
  	// register through the proxy server.
  	ident, err := registerThroughAuth(token, params)
  	if err != nil {
  		// If no params client was set this is a proxy and fail right away.
  		if params.CredsClient == nil {
  			log.Debugf("Missing client, failing with error from Auth Server: %v.", err)
  			return nil, trace.Wrap(err)
  		}
  
  		ident, er := registerThroughProxy(token, params)
  		if er != nil {
  			return nil, trace.NewAggregate(err, er)
  		}
  
  		log.Debugf("Successfully registered through proxy server.")
  		return ident, nil
  	}
  
  	log.Debugf("Successfully registered through auth server.")
  	return ident, nil
  }
docs: // Register is used to generate host keys when a node or proxy are running on
  // different hosts than the auth server. This method requires provisioning
  // tokens to prove a valid auth server was used to issue the joining request
  // as well as a method for the node to validate the auth server.