Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

refactor(social): use config for OAuth hosts everywhere

Paulo Castellano166008422788
diff --git a/app/Http/Controllers/Auth/BlueskyController.php b/app/Http/Controllers/Auth/BlueskyController.php
index 8ec10b912..4a74d99ae 100644
--- a/app/Http/Controllers/Auth/BlueskyController.php
+++ b/app/Http/Controllers/Auth/BlueskyController.php
@@ -53,7 +53,7 @@ class BlueskyController extends SocialController
$this->authorize('manageAccounts', $workspace);
- $service = 'https://bsky.social';
+ $service = config('trypost.platforms.bluesky.default_service');
try {
// Authenticate with Bluesky
diff --git a/app/Services/Social/BlueskyPublisher.php b/app/Services/Social/BlueskyPublisher.php
index f545e2df7..ec18db806 100644
--- a/app/Services/Social/BlueskyPublisher.php
+++ b/app/Services/Social/BlueskyPublisher.php
@@ -26,7 +26,7 @@ class BlueskyPublisher
$content = $postPlatform->post->content ? app(ContentSanitizer::class)->sanitize($postPlatform->post->content, $postPlatform->platform) : null;
$account = $postPlatform->socialAccount;
- $service = $account->meta['service'] ?? 'https://bsky.social';
+ $service = $account->meta['service'] ?? config('trypost.platforms.bluesky.default_service');
// Refresh token if needed
if ($account->is_token_expired || $account->is_token_expiring_soon) {
@@ -270,7 +270,7 @@ class BlueskyPublisher
public function refreshToken(SocialAccount $account): void
{
- $service = $account->meta['service'] ?? 'https://bsky.social';
+ $service = $account->meta['service'] ?? config('trypost.platforms.bluesky.default_service');
// Try refresh first
$response = $this->socialHttp()->withToken($account->refresh_token)
diff --git a/app/Services/Social/LinkedInPageAnalytics.php b/app/Services/Social/LinkedInPageAnalytics.php
index 8c809b9ac..1c2c5b6a7 100644
--- a/app/Services/Social/LinkedInPageAnalytics.php
+++ b/app/Services/Social/LinkedInPageAnalytics.php
@@ -240,7 +240,7 @@ class LinkedInPageAnalytics
throw new TokenExpiredException('No refresh token available for LinkedIn Page account');
}
- $response = Http::asForm()->post('https://www.linkedin.com/oauth/v2/accessToken', [
+ $response = Http::asForm()->post(config('trypost.platforms.linkedin.oauth_api').'/oauth/v2/accessToken', [
'grant_type' => 'refresh_token',
'refresh_token' => $account->refresh_token,
'client_id' => config('services.linkedin-openid.client_id'),
diff --git a/app/Services/Social/LinkedInPagePublisher.php b/app/Services/Social/LinkedInPagePublisher.php
index 7c7ed7965..d4a3c6910 100644
--- a/app/Services/Social/LinkedInPagePublisher.php
+++ b/app/Services/Social/LinkedInPagePublisher.php
@@ -458,7 +458,7 @@ class LinkedInPagePublisher
throw new TokenExpiredException('No refresh token available for LinkedIn Page account');
}
- $response = Http::asForm()->post('https://www.linkedin.com/oauth/v2/accessToken', [
+ $response = Http::asForm()->post(config('trypost.platforms.linkedin.oauth_api').'/oauth/v2/accessToken', [
'grant_type' => 'refresh_token',
'refresh_token' => $account->refresh_token,
'client_id' => config('services.linkedin-openid.client_id'),
diff --git a/app/Services/Social/LinkedInPublisher.php b/app/Services/Social/LinkedInPublisher.php
index 37bdd435d..540e37aea 100644
--- a/app/Services/Social/LinkedInPublisher.php
+++ b/app/Services/Social/LinkedInPublisher.php
@@ -439,7 +439,7 @@ class LinkedInPublisher
throw new TokenExpiredException('No refresh token available for LinkedIn account');
}
- $response = Http::asForm()->post('https://www.linkedin.com/oauth/v2/accessToken', [
+ $response = Http::asForm()->post(config('trypost.platforms.linkedin.oauth_api').'/oauth/v2/accessToken', [
'grant_type' => 'refresh_token',
'refresh_token' => $account->refresh_token,
'client_id' => config('services.linkedin.client_id'),
diff --git a/app/Services/Social/MastodonAnalytics.php b/app/Services/Social/MastodonAnalytics.php
index e071fbeb2..606ab8a06 100644
--- a/app/Services/Social/MastodonAnalytics.php
+++ b/app/Services/Social/MastodonAnalytics.php
@@ -20,7 +20,7 @@ class MastodonAnalytics
return ['unsupported' => true, 'reason' => 'missing_post_id'];
}
- $instance = data_get($account->meta, 'instance', 'https://mastodon.social');
+ $instance = data_get($account->meta, 'instance', config('trypost.platforms.mastodon.default_instance'));
// Public posts: no auth needed. Our token only requests write scopes
// (read:accounts + write:statuses + write:media), so attaching the
diff --git a/app/Services/Social/MastodonPublisher.php b/app/Services/Social/MastodonPublisher.php
index 66ac4b498..218d099de 100644
--- a/app/Services/Social/MastodonPublisher.php
+++ b/app/Services/Social/MastodonPublisher.php
@@ -25,7 +25,7 @@ class MastodonPublisher
$content = $postPlatform->post->content ? app(ContentSanitizer::class)->sanitize($postPlatform->post->content, $postPlatform->platform) : null;
$account = $postPlatform->socialAccount;
- $instance = $account->meta['instance'] ?? 'https://mastodon.social';
+ $instance = $account->meta['instance'] ?? config('trypost.platforms.mastodon.default_instance');
$medias = $postPlatform->post->mediaItems;
$mediaIds = [];
diff --git a/app/Services/Social/YouTubeAnalytics.php b/app/Services/Social/YouTubeAnalytics.php
index 0d42997eb..41f6a90c9 100644
--- a/app/Services/Social/YouTubeAnalytics.php
+++ b/app/Services/Social/YouTubeAnalytics.php
@@ -168,7 +168,7 @@ class YouTubeAnalytics
throw new TokenExpiredException('No refresh token available for YouTube account');
}
- $response = Http::asForm()->post('https://oauth2.googleapis.com/token', [
+ $response = Http::asForm()->post(config('trypost.platforms.youtube.oauth_api').'/token', [
'client_id' => config('services.google.client_id'),
'client_secret' => config('services.google.client_secret'),
'grant_type' => 'refresh_token',
diff --git a/app/Services/Social/YouTubePublisher.php b/app/Services/Social/YouTubePublisher.php
index 7525baa74..1f67c6d0f 100644
--- a/app/Services/Social/YouTubePublisher.php
+++ b/app/Services/Social/YouTubePublisher.php
@@ -229,7 +229,7 @@ class YouTubePublisher
throw new TokenExpiredException('No refresh token available for YouTube account');
}
- $response = Http::asForm()->post('https://oauth2.googleapis.com/token', [
+ $response = Http::asForm()->post(config('trypost.platforms.youtube.oauth_api').'/token', [
'client_id' => config('services.google.client_id'),
'client_secret' => config('services.google.client_secret'),
'grant_type' => 'refresh_token',