From e73582bfd4e5ee3f0b916d95a142031fe062379b Mon Sep 17 00:00:00 2001 From: Matt Morrisson Date: Thu, 20 Aug 2020 13:29:41 -0700 Subject: [PATCH] add support for OAuth state variable --- src/Mailchimp.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mailchimp.php b/src/Mailchimp.php index a4dc660d..ed63ecdd 100644 --- a/src/Mailchimp.php +++ b/src/Mailchimp.php @@ -273,12 +273,14 @@ public function verifiedDomains($domain_name = null) * * @param $client_id * @param $redirect_uri + * @param $state * * @return string */ public static function getAuthUrl( $client_id, - $redirect_uri + $redirect_uri, + $state = null ) { $encoded_uri = urlencode($redirect_uri); @@ -287,6 +289,10 @@ public static function getAuthUrl( $authUrl .= "&redirect_uri=" . $encoded_uri; $authUrl .= "&response_type=code"; + if ($state !== null) { + $authUrl .= "&state=" . $state; + } + return $authUrl; }