From 88d766f014e517107a3ad2b94019cc51f62a787a Mon Sep 17 00:00:00 2001 From: Robin van der Vleuten Date: Wed, 18 Jun 2014 15:34:31 +0200 Subject: [PATCH] Request for granting access token can contain JSON body. --- lib/OAuth2/OAuth2.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/OAuth2/OAuth2.php b/lib/OAuth2/OAuth2.php index 3a2d084..c738e88 100644 --- a/lib/OAuth2/OAuth2.php +++ b/lib/OAuth2/OAuth2.php @@ -760,7 +760,11 @@ public function grantAccessToken(Request $request = null) // Input data by default can be either POST or GET if ($request->getMethod() === 'POST') { - $inputData = $request->request->all(); + if (0 === strpos($request->headers->get('Content-Type'), 'application/json')) { + $inputData = json_decode($request->getContent(), true); + } else { + $inputData = $request->request->all(); + } } else { $inputData = $request->query->all(); }