yuya373 / emacs-slack

slack client for emacs
1.11k stars 117 forks source link

Trouble registering multiple teams #525

Closed jeongsoolee09 closed 3 years ago

jeongsoolee09 commented 3 years ago

I'm trying to add two teams with .authinfo.gpg, but the second team always fails to get registered.

Steps to reproduce the behavior:

  1. Add the following to the startup script (I use Spacemacs, so the following snippet is in my user-config of .spacemacs):
    (slack-register-team
    :name "Team 1"
    :token (auth-source-pick-first-password
         :host "team1.slack.com"
         :user "some_email@example.com"))
    (slack-register-team
    :name "Team 2"
    :token (auth-source-pick-first-password
         :host "team2.slack.com"
         :user "some_email@example.com"))
  2. Add the following to .authinfo and encrypt it symmetrically
    host team2.slack.com user some_email@example.com password xoxs-...
    host team1.slack.com user some_email@example.com password xoxs-...
  3. Restart Emacs
  4. Emacs complains that
    Decrypting /home/user_name/.authinfo.gpg...done
    (Spacemacs) Error in dotspacemacs/user-config: :token is required

Expected Behavior: Two teams get added, and Helm Slack Im Select shows those two teams.

Environment:

Also, I have observed that, having configured the startup script as described above, if I switch the two credential infos' order in .authinfo, to make Team 1 to be the first to appear like this:

host team1.slack.com user some_email@example.com password xoxs-...
host team2.slack.com user some_email@example.com password xoxs-...

Emacs even fails to register Team 1. Is there something I'm doing wrong?

jeongsoolee09 commented 3 years ago

Yay, solved. Use machine instead of host, for both authinfo.gpg and the keyword argument to auth-source-search (or auth-source-pick-first-password).