I would like to exchange on Freenode using ERC, however I do not know how to authenticate with SASL as required.

-xxxxxx.freenode.net- *** Lookup up your hostname...
-xxxxxx.freenode.net- *** Checking Ident
-xxxxxx.freenode.net- *** Found your hostname
-xxxxxx.freenode.net- *** No Ident response
-xxxxxx.freenode.net- *** Notice -- You need to identify via SASL to use
            this server

==> ERROR from irc.freenode.net: Closing Link:
xxxxxxxxxxxxxxxxxxxx.xx     (SASL access only)

Connection failed!  Not re-establishing connection.

*** ERC terminated: connection broken by remote peer

I looked quickly the ERC manual and the EmacsWiki website. I also noticed that Emacs has a SASL library. Moreover, a developer was proposing a SASL extension for ERC on a GitHub repository.

I am looking for a solution as well as an explanation (or overview) to facilitate a possible inspection of the source code. Eventually, you can specify how to proceed for other IRC clients (rcirc,...).


I ended up patching the erc-login function to use the SASL extension. I first installed this package https://github.com/joseph-gay/erc-sasl and added this to my init file:

(require 'erc-sasl)
(add-to-list 'erc-sasl-server-regexp-list "irc\\.freenode\\.net")

(defun erc-login ()
  "Perform user authentication at the IRC server. (PATCHED)"
  (erc-log (format "login: nick: %s, user: %s %s %s :%s"
           (or erc-system-name (system-name))
  (if erc-session-password
      (erc-server-send (format "PASS %s" erc-session-password))
    (message "Logging in without password"))
  (when (and (featurep 'erc-sasl) (erc-sasl-use-sasl-p))
    (erc-server-send "CAP REQ :sasl"))
  (erc-server-send (format "NICK %s" (erc-current-nick)))
   (format "USER %s %s %s :%s"
       ;; hacked - S.B.
       (if erc-anonymous-login erc-email-userid (user-login-name))
       "0" "*"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy