Closed liorp closed 2 months ago
Can you share your workflow and trigger definitions, please?
The workflow
import { DefineWorkflow, Schema } from "deno-slack-sdk/mod.ts";
import { LinkedInPostFunctionDefinition } from "../functions/_linkedin_post.ts";
const PostWorkflow = DefineWorkflow({
callback_id: "_post",
title: " a Post",
description: " a Post",
input_parameters: {
properties: {
message: {
type: Schema.types.string,
description: "The message",
},
user_id: {
type: Schema.slack.types.user_id,
description: "The user id",
},
},
required: ["message", "user_id"],
},
});
const Step = PostWorkflow.addStep(
LinkedInPostFunctionDefinition,
{
linkedin_access_token_id: {
credential_source: "END_USER",
},
message: PostWorkflow.inputs.message,
user_id: PostWorkflow.inputs.user_id,
},
);
PostWorkflow.addStep(Schema.slack.functions.SendDm, {
user_id: PostWorkflow.inputs.user_id,
message:
`Finished with ${Step.outputs.data}, error: ${Step.outputs.error}`,
});
export default PostWorkflow;
The trigger
import { Trigger } from "deno-slack-api/types.ts";
import { TriggerContextData, TriggerTypes } from "deno-slack-api/mod.ts";
import PostWorkflow from "../workflows/_post_link.ts";
const trigger: Trigger<typeof PostWorkflow.definition> = {
type: TriggerTypes.Shortcut,
name: "Linkedin post",
description: "Responds to a linkedin post",
workflow: `#/workflows/${PostWorkflow.definition.callback_id}`,
inputs: {
message: {
customizable: true,
},
user_id: {
value: TriggerContextData.Shortcut.user_id,
},
},
};
export default trigger;
I can confirm this issue. I will engage the backend 3P Auth team at Slack to see what the issue is.
We have identified the problem. The response from LinkedIn's token-exchange API is not exactly to the OAuth RFC spec (the scopes
field should be space delimited, whereas LinkedIn's response is comma-delimited). Thus the error around scope mismatch.
We are working on a fix! Will keep you posted as to progress there.
Hey @liorp , the fix was merged a couple hours ago and is deployed to production. I verified on my end that this now works 🎉
Going to close this, but if it's not working for you, feel free to re-open this issue or file a new one.
The
deno-slack
versionsDeno runtime version
OS info
Describe the bug
When implementing
DefineOAuth2Provider
with LinkedIn, the authorization fails withSteps to reproduce
const LinkedInProvider = DefineOAuth2Provider({ provider_key: "linkedin", provider_type: Schema.providers.oauth2.CUSTOM, options: { provider_name: "LinkedIn", authorization_url: "https://www.linkedin.com/oauth/v2/authorization", token_url: "https://www.linkedin.com/oauth/v2/accessToken", client_id: CLIENT_ID, scope: [ "email", "openid", "profile", "w_member_social", ], authorization_url_extras: { prompt: "consent", access_type: "offline", }, identity_config: { url: "https://api.linkedin.com/v2/userinfo", account_identifier: "$.sub", http_method_type: "GET", }, use_pkce: false, }, });
export default LinkedInProvider;
linkedin_access_token_id: { credential_source: "END_USER", },