Skip to content

Commit

Permalink
add support for OAuth state variable
Browse files Browse the repository at this point in the history
  • Loading branch information
mmorrisson committed Aug 20, 2020
1 parent 56e10b2 commit e73582b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
}

Expand Down

0 comments on commit e73582b

Please sign in to comment.