Need help creating a login plugin for sketchup

You could use the SketchUp API’s Sketchup::Http::Request class which is asynchronous or the Ruby Standard Library’s Net::HTTP class which is synchronous.

For the sign-in window you could use a simple UI.inputbox or a more complex UI::HtmlDialog. (The HTML dialog requires knowledge of HTML, CSS, JavaScript and Ruby.)

The UI.inputbox is rather simple …

module DongUniqueNamespace     # <<--- <<< change
  module PluginNeedingSignIn   # <<--- <<< change

    extend self

    def get_credentials
      prompts = ["Username", "Password"]
      defaults = ["", ""]
      result = UI.inputbox(prompts, defaults, "Sign In")
      result ? result[0], result[1] : "", ""
    end

    def sign_in
      return if @signed_in
      username, password = get_credentials()
      # send the credentials to your server, and set the @signed_in variable.
    end

    if !defined?(@loaded) # run once at startup block:
      UI.menu("Plugins").add_item("Dong Sign In") { sign_in() }
      @loaded = true
      @signed_in = false
    end

  end
end

(…scroll to see all code…)