Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"has_2FA" defaults to "false" when missing from API response #1121

Open
rmaalouf opened this issue Nov 1, 2022 · 1 comment
Open

"has_2FA" defaults to "false" when missing from API response #1121

rmaalouf opened this issue Nov 1, 2022 · 1 comment

Comments

@rmaalouf
Copy link

rmaalouf commented Nov 1, 2022

What happened

Supplying a bot token xoxb- has the side effect that "has_2fa" is not included in the response from Slack's users.list API. Though this is not documented, it has been confirmed by slack support

has_2fa parameter only shows if the person calling that endpoint is an Admin or Owner, and using a user token(starting with xoxp), and not a bot token(starting with xoxb).

In cases where has_2fa is missing from the response, GetUsersContext returns false for all users even though it may be enabled for some.

Expected behavior

has_2fa shouldn't default to false

Steps to reproduce

Configure the SDK with a bot token with the users:read scope. GetUsersContext will default to false for has_2fa.

Versions

  • Go: 1.19.2
  • slack-go/slack: 0.11.3
@mnafees
Copy link

mnafees commented Aug 27, 2024

I can confirm that I see the same behavior when querying the Slack API. The easiest fix would be to follow what the go-github community SDK follows and use pointers with omitempty for all JSON tags of response bodies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants