-
Notifications
You must be signed in to change notification settings - Fork 30
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
[QUERY] External auth for non-link events #401
Comments
Hey @radvansky-tomas 👋 Thanks for the inquiry! The tutorial you linked shows external authentication as part of a workflow that starts from a link trigger, but that workflow could start from other triggers, like the This has limitations around the ordering of steps - only link triggers contain With all of this, token rotation is taken care of for you! Let me know if setting up a workflow with one of these options works or if more detail is needed, I'm here to help 🙏 |
Sure thank you for reply, yes I tried all that. However I seem to not understand need for link trigger when So lets consider simple use case. You want to do external auth with your google sheets stuff. You do whatever is required to initialise workflow (my understanding is link shortcut) that will open that small banner, with run Workflow, then you connect via oAuth. But what next ?! It seems that every other event I am interested in:
Does NOT support END_USER, and only workaround I found was to "create" another link trigger after, and then run another workflow. That makes no sense to me. Now I am actually trying to do complete oAuth flow without using external auth approach (via navigating to urls + webhooks and storing tokens / doing refresh in datastore) so at least I will have some control over it. |
@radvansky-tomas Hmm, I'm not sure that those events restrict In an implemented workflow, that might resemble:
This setup requires another change to make use of const step = ExampleWorkflow.addStep(definition, {
providerAccessTokenId: {
credential_source: "END_USER",
+ user_context_source: "LAST_INTERACTOR",
},
}); This isn't documented on https://api.slack.com yet, but we're working on updating this. Here's an example button tooExampleWorkflow.addStep(Schema.slack.functions.SendDm, {
user_id: EventTriggerContextData.ReactionAdded.user_id,
message: "Proceed with the next step",
interactive_blocks: [
{
type: "actions",
elements: [
{
type: "button",
text: {
type: "plain_text",
text: "Click Me",
emoji: true,
},
},
],
},
],
}); I understand that this setup requires additional steps to complete each workflow, but I'm hoping it can still work so the advantages of token management with external authentication can be used! Let me know if this works for you or not 🙏 |
As I explained, I fully understand that for initialising oauth flow you need Link Trigger that I have and it works. https://api.slack.com/automation/external-auth#end-user-tokens
I didnt know about Basically I want to see some example of: With direct use of END_USER context |
So I have this:
And then:
And the moment I add any step with I've added |
@radvansky-tomas Thanks for sharing this example - this is great reference! 📚
This is all super good feedback! I agree that some events like I do also want to note that "link triggers" are different than message buttons. A link trigger starts a workflow, while message buttons can be included in messages and generate
The documentation right now isn't so clear on this, but including a message button before the external token step will generate workflow.addStep(Schema.slack.functions.SendDm, {
user_id: EventTriggerContextData.ReactionAdded.user_id,
message: "Proceed with the next step",
interactive_blocks: [
{
type: "actions",
elements: [
{
type: "button",
text: {
type: "plain_text",
text: "Click Me",
emoji: true,
},
},
],
},
],
}); Please let me know if adding this step starts your workflow again! |
Thank you for reply, but this is even worse than link trigger. I understand that "sometimes" event might not be triggered by actual user. But i dont see point why you cant just pass NULL there OR empty access token. Rather then dont execute trigger itself. As I said, use case is simple:
Whats the point of all that, if for every usable action, I have to start another workflow, click on some buttons and start another workflow ?! Now when you have valid access token connected to UserID, there should be a way to just "get it" Because now flow will look like this:
And that second part will happen EVERY SINGLE TIME. But if you think about this from user perspective (not global oauth) |
Update, yeah subsequent button presses does NOT invoke another modal, thats better. OK |
@radvansky-tomas I've been caught on this myself and am sharing the current reasoning for the product decision. Sharing the use case you're finding with
Glad to know this is a bit smoother, even if not so ideal. Please feel free to share examples or follow up with other questions whenever! 👾 |
I am trying to use external auth for non link events such as mentions, app mentions etc.
I saw example here:
https://api.slack.com/tutorials/tracks/oauth-tutorial
But this is using some form of hack method when instead of using external auth, they / you are creating link and then executing another workflow after. Which seem like massive pain.
I could probably handle whole oauth flow, but client.apps.auth.external.get does not expose refresh token, so manual refresh is not doable. I guess I can make custom webhook to capture whole oauth flow.
But before I do, that Id like to know, if there is really no way for me just running reaction events with oauth in place, with automatic token refresh mechanism, without constant recreation of links back/forth.
The text was updated successfully, but these errors were encountered: