diff --git a/README.md b/README.md index 820187a..9463ef0 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,15 @@ FIRECRAWL_API_KEY= ARCADE_API_KEY= ``` +If you plan to post to LinkedIn as an organization (rather than as yourself), you'll also need to set: + +```bash +# Get the organization ID from the URL of the company page when you're logged in as an admin. +# For example, if the URL is `https://www.linkedin.com/company/12345678/admin/dashboard/`, the organization ID would be `12345678`. +POST_TO_LINKEDIN_ORGANIZATION=true +LINKEDIN_ORGANIZATION_ID= +``` + ### Install LangGraph CLI ```bash @@ -217,6 +226,15 @@ Then, you will need to set these environment variables in your `.env` file: Make sure you have the `USE_ARCADE_AUTH` environment variable set to `true` to have the graph use Arcade authentication. +If you plan to post to LinkedIn as an organization (rather than as yourself), you'll also need to set: + +```bash +# Get the organization ID from the URL of the company page when you're logged in as an admin. +# For example, if the URL is `https://www.linkedin.com/company/12345678/admin/dashboard/`, the organization ID would be `12345678`. +LINKEDIN_ORGANIZATION_ID= +POST_TO_LINKEDIN_ORGANIZATION=true +``` + > Note: > > If you want to upload media to Twitter, you will still need to set up your own Twitter developer account (below) in addition to using Arcade. diff --git a/src/agents/shared/auth/linkedin.ts b/src/agents/shared/auth/linkedin.ts index 209c115..258995e 100644 --- a/src/agents/shared/auth/linkedin.ts +++ b/src/agents/shared/auth/linkedin.ts @@ -100,14 +100,8 @@ async function getArcadeLinkedInAuthOrInterrupt( const scopes = fields?.postToOrg ? ["w_member_social", "w_organization_social"] : ["w_member_social"]; - const authResponse = await arcade.auth.authorize({ - user_id: linkedInUserId, - auth_requirement: { - provider_id: "linkedin", - oauth2: { - scopes, - }, - }, + const authResponse = await arcade.auth.start(linkedInUserId, "linkedin", { + scopes, }); const authUrl = authResponse.url; diff --git a/src/clients/linkedin.ts b/src/clients/linkedin.ts index f141c9e..0d7b22e 100644 --- a/src/clients/linkedin.ts +++ b/src/clients/linkedin.ts @@ -286,14 +286,8 @@ export class LinkedInClient { }, ): Promise { const scopes = LinkedInClient.getScopes(fields?.postToOrganization); - const authRes = await client.auth.authorize({ - user_id: id, - auth_requirement: { - provider_id: "linkedin", - oauth2: { - scopes, - }, - }, + const authRes = await client.auth.start(id, "linkedin", { + scopes, }); if (authRes.status === "completed") { @@ -324,14 +318,8 @@ export class LinkedInClient { apiKey: process.env.ARCADE_API_KEY, }); const scopes = LinkedInClient.getScopes(fields?.postToOrganization); - const authRes = await arcade.auth.authorize({ - user_id: linkedInUserId, - auth_requirement: { - provider_id: "linkedin", - oauth2: { - scopes, - }, - }, + const authRes = await arcade.auth.start(linkedInUserId, "linkedin", { + scopes, }); if (!authRes.context?.token || !authRes.context?.user_info?.sub) { diff --git a/src/clients/twitter/client.ts b/src/clients/twitter/client.ts index 35862c9..5a5b6bb 100644 --- a/src/clients/twitter/client.ts +++ b/src/clients/twitter/client.ts @@ -110,14 +110,8 @@ export class TwitterClient { id: string, client: Arcade, ): Promise { - const authRes = await client.auth.authorize({ - user_id: id, - auth_requirement: { - provider_id: "x", - oauth2: { - scopes: ["tweet.write", "users.read", "tweet.read", "offline.access"], - }, - }, + const authRes = await client.auth.start(id, "x", { + scopes: ["tweet.write", "users.read", "tweet.read", "offline.access"], }); if (authRes.status === "completed") {