Closed aculich closed 2 years ago
+1 this addressed the issue for me. Older teams I have xoxs tokens but a new team, only an xoxc token could be found. Applying these patches and adding the encoded value of the d
cookie worked.
Thanks @aculich! Hope this gets merged soon.
been using it for the past 4 days on the corporate slack. works as expected.
@yuya373 any chance you could merge this pull request soon?
Let me know if there are any other changes you'd like me to make.
@yuya373 Can confirm that this patch takes care of this use case.
Any update on this ?
Just confirming that this fix is working for me also :+1:
i am still getting the invalid_auth
error :/
This fixed the issue for me as well. Thanks for the awesome work!
PR helped me solving the issue. It works like a charm. @yuya373 : Fancy to review and merge?
Was this merged into the actual MELPA version of this project?
I ask because I installed the latest MELPA version with 'use-package', and am getting authorization errors despite having a correct token. Do you have to do something special in order to have this 'PR' be able to be used for the 'emacs-slack' package?
A random note is that I had to MANUALLY install the 'slack' package with 'M-x package-install' because MELPA kept complaining that it did not know what the 'slack' package was. I even tried 'emacs-slack' as well in the same config but that didn't work either. This was after even doing 'M-x package-refresh-contents' so I think you guys might want to check into that, or maybe its assumed that el-get is needed at the bare minimum, not sure. I use 'use-package' like most people though.
NOTE: A lot of what I am about to present is modified, so keep that in mind since its personal.
Here's the error that I am getting when I try to manually start 'slack-start' with 'M-x slack-start':
Failed to request slack-authorize: invalid_auth
For reference, here's what I have in my literal Emacs config in configuration.org:
** Add 'slack' and related dependencies for work IRC fun (NOTE: Multi-tiered headings)
*** Install 'slack' package
#+BEGIN_SRC emacs-lisp
(use-package slack
:ensure t
:init
(setq slack-prefer-current-team t)
:config
(slack-register-team
:name "team"
:default t
:token (auth-source-pick-first-password
:host "company.slack.com"
:user "corporateemail@email.com")))
#+END_SRC
*** Set the 'auth-sources' variable for 'slack'
#+BEGIN_SRC emacs-lisp
(setq auth-sources '(default
"~/.authinfo"))
#+END_SRC
*** Add 'circe' as 'emacs-slack' dependency
#+BEGIN_SRC emacs-lisp
(use-package circe
:ensure t)
#+END_SRC
*** Add 'emojify' as 'emacs-slack' dependency
#+BEGIN_SRC emacs-lisp
(use-package emojify
:ensure t)
#+END_SRC
*** Add 'oauth2' as 'emacs-slack' dependency
#+BEGIN_SRC emacs-lisp
(use-package oauth2
:ensure t)
#+END_SRC
*** Add 'alert' as 'emacs-slack' dependency
#+BEGIN_SRC emacs-lisp
(use-package alert
:commands (alert)
:init
(setq alert-default-style 'notifier))
#+END_SRC
*** Add 'request' as 'emacs-slack' dependency
#+BEGIN_SRC emacs-lisp
(use-package request
:ensure t)
#+END_SRC
*** Add 'websocket' as 'emacs-slack' dependency
#+BEGIN_SRC emacs-lisp
(use-package websocket
:ensure t)
#+END_SRC
Also, here's what I have in my ~/.authinfo (certain things taken out):
machine corporate.slack.com login workEmail@email.com password "ReallyLongToken"
Was this merged into the actual MELPA version of this project?
Definitely not. I think @yuya373 has a lot on his plate because the package feels a bit unmaintained. You will have to use the package from this commit.
For example, I created my own fork pointing to this PR and I setup with
(use-package slack
:load-path "~/where-the-git-repo-is/emacs-slack"
)
Having your own fork has the benefit that you can merge the open PRs yourself, without waiting for the maintainer.
I think there are ways to pull directly from github (like with straight or quelpa), but I prefer forking manually the few packages that go unmaintained.
Was this merged into the actual MELPA version of this project?
Definitely not. I think @yuya373 has a lot on his plate because the package feels a bit unmaintained. You will have to use the package from this commit.
For example, I created my own fork pointing to this PR and I setup with
(use-package slack :load-path "~/where-the-git-repo-is/emacs-slack" )
Having your own fork has the benefit that you can merge the open PRs yourself, without waiting for the maintainer.
I think there are ways to pull directly from github (like with straight or quelpa), but I prefer forking manually the few packages that go unmaintained.
Hey ag91,
Awesome, thanks for this insight. I'm a bit of a newbie when it comes to GitHub sometimes as I use 'git' mostly for personal projects.
Can you please help me with the workflow you described in your earlier post:
If I'm understanding you correctly I have to do the following actions:
I ask this because I've seen people's Emacs configs where they use 'straight.el' or something like that to rip GitHub projects manually instead of depending on MELPA, but my current Emacs config really just depends on MELPA, so I'm a bit new to using GitHub directly for Emacs packages.
Thanks again, looking forward to your reply as I would totally want to use this for work based Slack stuff in Emacs to prevent too much distraction.
No problem.
Yeah, same here: I don't use straight.el so I do this manually. With that, you may manage to just give the link to this PR to use-package, and it would do something like the above for you.
Can report this worked for me as well.
Why am I getting invalid_auth after successful web-socket connection?
What I run:
(use-package slack
:load-path "~/local/software/emacs-slack"
:commands (slack-start)
:init
(setq slack-buffer-emojify t) ;; if you want to enable emoji, default nil
(setq slack-prefer-current-team t)
:config
(slack-register-team
:name "xxx"
:default t
:token "xoxc-..."
:cookie "fD1SXZ8..."
:subscribed-channels '(general)
)
)
What I get:
uncompressing publicsuffix.txt.gz...done
[2021-11-11 15:05:17] [info] [xxx] Slack Websocket Is Ready!
Failed to request slack-conversations-list: invalid_auth
Failed to request slack-usergroup-list-request: invalid_auth
Failed to request slack-commands-list-request: invalid_auth
Failed to request slack-download-emoji: invalid_auth
Any ideas?
@NimSed sometime delete the emacs-slack folder from .emacs.d directory somewhere will helps you. I'm use doom-emacs, after merged cookie code PR, I got invalid_auth error too. after delete that directory and change cookie value, resync, every things fine .
I emailed @yuya373 asking again to merge this PR in case previous github notifications were missed.
In that email I also asked if more maintainers could be added for this package so others can help out.
Who on this thread would be interested in becoming a maintainer?
In the meantime, whether or not you'd like to help maintain this package, please consider contributing to yuya373's patreon if you use this package regularly.
Thank you so much @yuya373 !
This is awesome, thanks for this yuya373!
I appreciate this since I was still a bit daunted on the steps that an earlier user provided (which is awesome) but yeah, kind of a stretch for a total hobbyist like myself.
Gonna check this out sometime this week :)
On Mon, Nov 29, 2021, at 6:31 AM, Stephan wrote:
Thank you so much @yuya373 https://github.com/yuya373 !
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/yuya373/emacs-slack/pull/552#issuecomment-981329328, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVU3GXMJEEHBMYHAXM2O4ADUOMM5LANCNFSM473NMFTA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
@NimSed sometime delete the emacs-slack folder from .emacs.d directory somewhere will helps you. I'm use doom-emacs, after merged cookie code PR, I got invalid_auth error too. after delete that directory and change cookie value, resync, every things fine .
Thanks. I can confirm that after re-installing from @yuya373 's updated package on Melpa, it is working flawlessly. Thanks to both of you :man_dancing:
I know its been a while but had to deal with a few things in the past few months.
I just deleted the 'slack-20210712.628' folder from ~/.emacs.d/elpa directory.
Then, I used 'M-x package-refresh-contents'.
Yet, I'm still getting the same 'slack-20210712.628' package to be present after the package has refreshed its contents.
This probably isn't right, since it looks like the latest version is 'slack 20211129.310' according to MELPA: https://melpa.org/#/slack
This is annoying since I'm still getting the 'Failed to request slack-authorize: invalid_auth' error, even after confirming I have the latest xoxc token present in ~/.authinfo.
Related '~/.emacs.d/configuration.org' Emacs config:
*** Install 'slack' package
#+BEGIN_SRC emacs-lisp
;; Adding this ONLY for Macbook:
(when (string= system-name "myComputerName")
(use-package slack
:ensure t
:init
(setq slack-prefer-current-team t)
:config
(slack-register-team
:name "teamName"
:default t
:token (auth-source-pick-first-password
:host '("host.slack.com")
:user "token"
:type 'netrc
:max 1))))
#+END_SRC
*** Set the 'auth-sources' variable for 'slack'
#+BEGIN_SRC emacs-lisp
;; Adding this ONLY for Macbook:
(when (string= system-name "myComputerName")
(setq auth-sources '("~/.authinfo")))
#+END_SRC
*** Add 'circe' as 'emacs-slack' dependency
#+BEGIN_SRC emacs-lisp
;; Adding this ONLY for Macbook:
(when (string= system-name "myComputerName")
(use-package circe
:ensure t))
#+END_SRC
*** Add 'emojify' as 'emacs-slack' dependency
#+BEGIN_SRC emacs-lisp
;; Adding this ONLY for Macbook:
(when (string= system-name "myComputerName")
(use-package emojify
:ensure t))
#+END_SRC
*** Add 'oauth2' as 'emacs-slack' dependency
#+BEGIN_SRC emacs-lisp
;; Adding this ONLY for Macbook:
(when (string= system-name "myComputerName")
(use-package oauth2
:ensure t))
#+END_SRC
*** Add 'alert' as 'emacs-slack' dependency
#+BEGIN_SRC emacs-lisp
;; Adding this ONLY for Macbook:
(when (string= system-name "myComputerName")
(use-package alert
:commands (alert)
:init
(setq alert-default-style 'notifier)))
#+END_SRC
*** Add 'request' as 'emacs-slack' dependency
#+BEGIN_SRC emacs-lisp
;; Adding this ONLY for Macbook:
(when (string= system-name "myComputerName")
(use-package request
:ensure t))
#+END_SRC
*** Add 'websocket' as 'emacs-slack' dependency
#+BEGIN_SRC emacs-lisp
;; Adding this ONLY for Macbook:
(when (string= system-name "myComputerName")
(use-package websocket
:ensure t))
#+END_SRC
What's present in ~/.authinfo:
machine host.slack.com login token password "reallyLongToken"
Because of the weird MELPA issues, I tried to manually install it with the 'install' GUI button in 'M-x list-packages' and found the 'slack-20211129.310' package.
Side Note: Why is the older 'slack-20210712.628' version still appearing by default on the 'M-x list-packages', this should probably be removed.
I am still getting the same error as before:
Failed to request slack-authorize: invalid_auth
My config is still the same as my previous post.
@eggcaker @aculich @NimSed
@SamuelBanya did you try upgrade all packages in ELPA packages list buffer with U
( I guess it's on vanilla emacs ). I'm using doom-emacs , just delete package's folder then reload emacs it reinstall the package.
@eggcaker Wait, you're stating to go to 'M-x list-packages' and hit 'U' to upgrade?
I deleted the package folder, and nuked my 'configuration.el', and then re-opened Emacs which rebuilt my config.
The deeper problem is that even I manually install the latest version of this project by just manually installing it with 'Install' on 'M-x list packages', I'm still getting the same exact auth issue present.
Unfortunately I have some issues with newer Slack setups (guest account on another workspace) where I get the same invalid_auth
errors.
An older xoxs
token works fine, and I also had a slightly older workspace setup with an xoxc
token already working, but two newer workspaces throw this error message.
I copied both token & cookie a second time just to be sure that I did not make a silly mistake. I also tried to put the token & cookie directly into the function call instead of ~/.authinfo
, but this also does not work:
(slack-register-team
:name "workspace"
:default t
:token "xoxc-256...ca"
:cookie "xoxd-f5Z...%3D%3D"
:subscribed-channels '(guests random))
I have no idea how to debug this further. Does anybody else have issues with guest accounts on restricted workspaces?
This PR adds support and documentation for how to get a
d=
cookie that is required forxoxc
tokens. This may or may not be related to two other issues431 and #481 that mention trouble related to
xoxc
tokens.