Skip to content

Commit 9c7f7e3

Browse files
committed
fix post oauth token method
1 parent d195fae commit 9c7f7e3

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/Authentication/Hosted.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* ----------------------------------------------------------------------------------
1313
*
1414
* @author lanlin
15-
* @change 2020/06/24
15+
* @change 2021/11/23
1616
*/
1717
class Hosted
1818
{
@@ -81,14 +81,12 @@ public function postOAuthToken(string $code): array
8181

8282
$params = $this->options->getClientApps();
8383

84-
$params['code'] = $code;
85-
86-
$query = ['grant_type' => 'authorization_code'];
87-
$query = \array_merge($query, $params);
84+
$params['code'] = $code;
85+
$params['grant_type'] = 'authorization_code';
8886

8987
return $this->options
9088
->getSync()
91-
->setQuery($query)
89+
->setFormParams($params)
9290
->post(API::LIST['oAuthToken']);
9391
}
9492

src/Webhooks/Webhook.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(Options $options)
3939
// ------------------------------------------------------------------------------
4040

4141
/**
42-
* echo challenge to validate webhook
42+
* echo challenge to validate webhook (for fpm mode)
4343
*
4444
* TIPS: you'd better use the output method from your framework.
4545
*/
@@ -60,7 +60,7 @@ public function echoChallenge(): void
6060
// ------------------------------------------------------------------------------
6161

6262
/**
63-
* get notification & parse it
63+
* get notification & parse it (for fpm mode)
6464
*
6565
* @return array
6666
* [
@@ -90,7 +90,7 @@ public function getNotification(): array
9090
// ------------------------------------------------------------------------------
9191

9292
/**
93-
* webhook X-Nylas-Signature header verification
93+
* webhook X-Nylas-Signature header verification (for other mode)
9494
*
9595
* @see https://docs.nylas.com/reference#receiving-notifications
9696
*

0 commit comments

Comments
 (0)