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

Auth test is failing when used with v2 oauth user token that also has a bot token. #1354

Open
thomsong opened this issue Oct 5, 2021 · 3 comments
Labels
auto-triage-skip bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented pkg:oauth applies to `@slack/oauth-helper`

Comments

@thomsong
Copy link

thomsong commented Oct 5, 2021

This auth test is failing when i use the v2 oauth for a bot and user token in a non-enterprise workspace. Not sure if this is a slack API error, but either way, it should only be run inside the if statement since it's only used inside that one if.

In prior releases, the major block was an else, and now they are two if statements, which is maybe why the code is being executed now, where it wasn't before.

Suggested change is:

 if (v2Resp.is_enterprise_install && v2Installation.enterpriseUrl === undefined) {
    const authResult = await runAuthTest(v2Resp.authed_user.access_token, this.clientOptions);
    v2Installation.enterpriseUrl = authResult.url;
}

const authResult = await runAuthTest(v2Resp.authed_user.access_token, this.clientOptions);

@mwbrooks mwbrooks added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented pkg:oauth applies to `@slack/oauth-helper` labels Oct 5, 2021
@mwbrooks
Copy link
Member

mwbrooks commented Oct 5, 2021

@thomsong thanks for taking the time to report this issue! 🙇🏻

I may be understanding the logic incorrectly, but should the suggested change be (!== undefined)?

if (v2Resp.is_enterprise_install && v2Installation.enterpriseUrl !== undefined) {

@misscoded I noticed that this logic was touched when the token rotation feature was added. Would you mind looking over the suggestion above to ensure it works with the upcoming auth changes?

@mwbrooks
Copy link
Member

mwbrooks commented Oct 5, 2021

@thomsong I spoke with @misscoded offline - you may want to read through issue #1342. At the moment, @slack/oauth doesn't completely support the "Sign-in with Slack" flow and you may be running into that issue. There's a recommended workaround included in the issue.

@github-actions
Copy link

github-actions bot commented Dec 5, 2021

👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-triage-skip bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented pkg:oauth applies to `@slack/oauth-helper`
Projects
None yet
Development

No branches or pull requests

3 participants