Skip to content

Commit ed3f92c

Browse files
Merge pull request #1039 from Codeinwp/bugfix/pro/593
Fixed mastodon network issue with custom domain
2 parents 78b58c4 + 7e1aa75 commit ed3f92c

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

includes/admin/services/class-rop-mastodon-service.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,12 +550,24 @@ private function get_oauth_url() {
550550
session_start();
551551
}
552552
$consumer_key = isset( $_SESSION['rop_mastodon_credentials']['consumer_key'] ) ? $this->str_decrypt( $_SESSION['rop_mastodon_credentials']['consumer_key'] ) : '';
553+
$domain = isset( $_SESSION['rop_mastodon_credentials']['md_domain'] ) ? $_SESSION['rop_mastodon_credentials']['md_domain'] : 'mastodon.social';
553554
if ( empty( $consumer_key ) ) {
554555
return false;
555556
}
556557
$url = $this->get_legacy_url();
557558
$scopes = $this->scopes;
558-
return "https://mastodon.social/oauth/authorize?client_id=$consumer_key&redirect_uri=$url&scope=$scopes&response_type=code&state=mastodon";
559+
560+
$auth_url = $this->get_api_endpoint( $domain, 'oauth/authorize' );
561+
return add_query_arg(
562+
array(
563+
'client_id' => $consumer_key,
564+
'redirect_uri' => $url,
565+
'scope' => $scopes,
566+
'response_type' => 'code',
567+
'state' => 'mastodon',
568+
),
569+
$auth_url
570+
);
559571
}
560572

561573
/**

0 commit comments

Comments
 (0)