Skip to content

Commit

Permalink
Add correct encoding and the required state param. (#599)
Browse files Browse the repository at this point in the history
* Add correct encoding and the required state param.

* Set default state when stateless.

* Update TwitterProvider.php

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
xhezairbey and taylorotwell authored Aug 8, 2022
1 parent 9afc1e9 commit 3eec261
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Two/TwitterProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ class TwitterProvider extends AbstractProvider
*/
protected $scopeSeparator = ' ';

/**
* The query encoding format.
*
* @var int
*/
protected $encodingType = PHP_QUERY_RFC3986;

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -83,4 +90,18 @@ public function getAccessTokenResponse($code)

return json_decode($response->getBody(), true);
}

/**
* {@inheritdoc}
*/
protected function getCodeFields($state = null)
{
$fields = parent::getCodeFields($state);

if ($this->isStateless()) {
$fields['state'] = 'state';
}

return $fields;
}
}

0 comments on commit 3eec261

Please sign in to comment.