Skip to content

Commit 3eec261

Browse files
Add correct encoding and the required state param. (#599)
* Add correct encoding and the required state param. * Set default state when stateless. * Update TwitterProvider.php Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent 9afc1e9 commit 3eec261

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Two/TwitterProvider.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ class TwitterProvider extends AbstractProvider
2828
*/
2929
protected $scopeSeparator = ' ';
3030

31+
/**
32+
* The query encoding format.
33+
*
34+
* @var int
35+
*/
36+
protected $encodingType = PHP_QUERY_RFC3986;
37+
3138
/**
3239
* {@inheritdoc}
3340
*/
@@ -83,4 +90,18 @@ public function getAccessTokenResponse($code)
8390

8491
return json_decode($response->getBody(), true);
8592
}
93+
94+
/**
95+
* {@inheritdoc}
96+
*/
97+
protected function getCodeFields($state = null)
98+
{
99+
$fields = parent::getCodeFields($state);
100+
101+
if ($this->isStateless()) {
102+
$fields['state'] = 'state';
103+
}
104+
105+
return $fields;
106+
}
86107
}

0 commit comments

Comments
 (0)