question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authorize with multiple bot IDs

See original GitHub issue

Description

When an app is installed on an organization (for use of Admin APIs) incoming events may have the same bot user ID but different bot IDs. Currently, the authorize callback only allows apps to return a single bot ID as a single string. We could make that type a string | string[] | undefined and update the ignoreSelf middleware to iterate over the array to match events that should be ignored.

const app = new App({
  authorize: async ({ }) => {
    // lookup installations in database ...
    return {
      userToken: 'xoxp-...',
      botToken: 'xoxb-...',
      botId: ['B12345', 'B67890'],
      botUserId: 'W54321',
    };
  },
});

Requirements (place an x in each of the [ ])

  • I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
  • I’ve read and agree to the Code of Conduct.
  • I’ve searched for any related issues and avoided creating a duplicate issue.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
seratchcommented, Feb 9, 2020

@josh91hickman Thanks for taking the time to make the PR! The following comment may affect your PR. 🙏

@aoberoi I revisited this issue and came to think of the possibility to have another field name botIds in the case.

// in the case of workspace-level installation
return {
  userToken: 'xoxp-...',
  botToken: 'xoxb-...',
  botId: 'B12345',
  botUserId: 'W54321',
};

// in the case of org-level installation
return {
  userToken: 'xoxp-...',
  botToken: 'xoxb-...',
  botIds: ['B12345', 'B67890'],
  botUserId: 'W54321',
};

To me, returning either of botId or botIds is more consistent in terms of naming. This means Bolt expects botId for workspace installed apps while it understands the apps is org-level installed one by encountering botIds.

Do you believe we should go with botId for both?

0reactions
seratchcommented, Mar 19, 2021

This task is no longer relevant. Let me close it now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add authentication to a bot in Bot Framework SDK - Bot Service
Go to the Azure Bot resource blade for your bot. Go to the bot's Configuration blade. Select Manage, next to Microsoft App ID,...
Read more >
Is it possible to use the same EndPoint for several Microsoft Bots
So you want multiple bot identities for the same endpoint. I believe your only option is to implement authentication yourself (check a list...
Read more >
Advanced Discord Server Verification Bot - YouTube
... I implemented an advanced authorization bot for Discord Servers. ... to encrypt guild and user ids as well as decrypt encrypted strings....
Read more >
Adding your bot to servers - discord.js Guide
client_id=... is to specify which application you want to authorize. You'll need to replace this part with your client's id to create a...
Read more >
Getting an id token from the Azure Bot Service when ...
For our proxy we need to implement two API's, in this case we will be wrapping the Azure Active Directory Authentication and Token...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found