From 9c7f7e308336a98f63b604ccbc8ec1e08cf74ab2 Mon Sep 17 00:00:00 2001 From: lanlin Date: Tue, 23 Nov 2021 18:37:27 +0800 Subject: [PATCH] fix post oauth token method --- src/Authentication/Hosted.php | 10 ++++------ src/Webhooks/Webhook.php | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Authentication/Hosted.php b/src/Authentication/Hosted.php index dd4fc40..f13987f 100644 --- a/src/Authentication/Hosted.php +++ b/src/Authentication/Hosted.php @@ -12,7 +12,7 @@ * ---------------------------------------------------------------------------------- * * @author lanlin - * @change 2020/06/24 + * @change 2021/11/23 */ class Hosted { @@ -81,14 +81,12 @@ public function postOAuthToken(string $code): array $params = $this->options->getClientApps(); - $params['code'] = $code; - - $query = ['grant_type' => 'authorization_code']; - $query = \array_merge($query, $params); + $params['code'] = $code; + $params['grant_type'] = 'authorization_code'; return $this->options ->getSync() - ->setQuery($query) + ->setFormParams($params) ->post(API::LIST['oAuthToken']); } diff --git a/src/Webhooks/Webhook.php b/src/Webhooks/Webhook.php index 0483c24..e856e3e 100644 --- a/src/Webhooks/Webhook.php +++ b/src/Webhooks/Webhook.php @@ -39,7 +39,7 @@ public function __construct(Options $options) // ------------------------------------------------------------------------------ /** - * echo challenge to validate webhook + * echo challenge to validate webhook (for fpm mode) * * TIPS: you'd better use the output method from your framework. */ @@ -60,7 +60,7 @@ public function echoChallenge(): void // ------------------------------------------------------------------------------ /** - * get notification & parse it + * get notification & parse it (for fpm mode) * * @return array * [ @@ -90,7 +90,7 @@ public function getNotification(): array // ------------------------------------------------------------------------------ /** - * webhook X-Nylas-Signature header verification + * webhook X-Nylas-Signature header verification (for other mode) * * @see https://docs.nylas.com/reference#receiving-notifications *