wohali/ips4-oauth2-server

Grant type was not specified in the request

arthurdapaz opened this issue · 2 comments

Everything is fine in my client app. I'm doing a POST with the rights parameters as you can see (and I debugged on my app):

MyApp[]: PARMS {

"client_id" = FAKEFAKEFAKEFAKEFAKE;
"client_secret" = FAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKE;
code = "AQC33aQPjpXwIJxovd1hOLIq-9HgYqrchH6Q4dYdCe5LW-38aQ_305sfnCDQz6Ykn5fLtvdfMAfjM3u7nfEaWOZTEZFpChmxfefYfKGrPvVdpuunfY9KMzwwfeVzeQn38J2LoFek9-GD9sHa2gJVCxREkmDUT4W8xBt27NjYHX5XgDbUCPTqk1NgW3lHQSxwJfRvpzeX8US2CaPSFygmfJgvwDJmHNSskt1v0_WjCYDFg0R82Nnla63CS5c86ODDOZctPSAtoCjK14GxJrRROVY5I24X_3JXBQzBv-CpTuRFI_yxKrErAGBP74_v9KZdQPE";
"grant_type" = "authorization_code";
"redirect_uri" = "https://mywebsite.com/OAuthCallBack.php";

}

but the IPB OAuth2 Server is giving me this weird behavior:

{"error":"invalid_request","error_description":"The grant type was not specified in the request"}

HI @arthurdapaz,

That error is coming from the embedded PHP OAuth code that I use (but didn't write myself). Here's the specific lines of code:

https://github.com/wohali/ips4-oauth2-server/blob/master/sources/OAuth2/Controller/TokenController.php#L84-L92

Since I don't have access to your setup, I can't be sure what is wrong. You could try modifying the failure that is returned to include the output of the entire request object, something like:

$response->setError(400, 'invalid_request', 'The grant type was not specified in the request ' + json_encode($request));

and see what you get back. That should help you see what the request actually looks like on the server side. Hopefully it's something simple like a misspelling or a nesting issue.

@arthurdapaz Hey, could you leave a note here as to what was actually wrong? I'm guessing it was something on your side, otherwise you would have left the ticket open...