Quand vous faites Grant Implicite Type sur la Laravel 5.4 Documentation Réponse:
Pourquoi Implicite Grant ne fonctionne pas
Suite aux résultats de tutoriel en:
// 20170711152854
// http://oauth2server1/oauth/authorize?KEY=14997536295521&client_id=1&redirect_uri=http%3A%2F%2Fauthorizationgrantclient1%2Fcallback&response_type=token&scope=%3FXDEBUG_SESSION_START%3DECLIPSE`enter code here`_DBGP
{
"error": "unsupported_grant_type",
"message": "The authorization grant type is not supported by the authorization server.",
"hint": "Check the `grant_type` parameter"
}
============================================================================================
Dans le code de demande de jeton de subvention implicite, il fait une demande à: http://oauth2server1/oauth/authorize $ query
============================================================================================
Le gestionnaire de oauth/autoriser la demande GET est: Laravel \ Passeport \ Http \ contrôleurs \ AuthorizationController @ autoriser selon route artisan php: liste
============================================================================================
... Quelque part sur la ligne
============================================================================================
In vendor\league\oauth2-server\src\AuthorizationServer.php -> function validateAuthorizationRequest()
/**
* Validate an authorization request
*
* @param ServerRequestInterface $request
*
* @throws OAuthServerException
*
* @return AuthorizationRequest
*/
public function validateAuthorizationRequest(ServerRequestInterface $request)
{
foreach ($this->enabledGrantTypes as $grantType)
{
if($grantType->canRespondToAuthorizationRequest($request)) // <— ValidationStartsHere
{
return $grantType->validateAuthorizationRequest($request);
}
}
throw OAuthServerException::unsupportedGrantType();
}
============================================================================================
... Quelque part sur la ligne
============================================================================================
In vendor/league/oauth2-server/src/Grant/AuthCodeGrant.php -> function canRespondToAuthorizationRequest()
/**
* {@inheritdoc}
*/
public function canRespondToAuthorizationRequest(ServerRequestInterface $request)
{
return (array_key_exists('response_type', $request->getQueryParams()) // TRUE
&& $request->getQueryParams()['response_type'] === 'code' // FALSE
&& isset($request->getQueryParams()['client_id']) // TRUE
);
}
the values of the following variables are as follows:
$request->getQueryParams():
“KEY” => “14997536295521”,
“client_id” => “1”,
“redirect_uri” => “http://authorizationgrantclient1/callback”, // refer this value back to how to make an implicit grant token request
“response_type” => “token”,
“scope” => “”
comme un effet ... ce code renvoie toujours faux, et l'exécution de code revient à la fonction appelante
============================================================================================
going back to vendor\league\oauth2-server\src\AuthorizationServer.php->validateAuthorizationRequest()
/**
* Validate an authorization request
*
* @param ServerRequestInterface $request
*
* @throws OAuthServerException
*
* @return AuthorizationRequest
*/
public function validateAuthorizationRequest(ServerRequestInterface $request)
{
foreach ($this->enabledGrantTypes as $grantType) {
if ($grantType->canRespondToAuthorizationRequest($request)) {
return $grantType->validateAuthorizationRequest($request);
}
}
throw OAuthServerException::unsupportedGrantType(); // <—looks familiar?
}
============================================================================================
... quelque part sur la ligne
============================================================================================
In vendor\league\oauth2-server\src\Exception\OAuthServerException.php->function unsupportedGrantType()
/**
* Unsupported grant type error.
*
* @return static
*/
public static function unsupportedGrantType()
{
$errorMessage = 'The authorization grant type is not supported by the authorization server.';
$hint = 'Check the `grant_type` parameter';
return new static($errorMessage, 2, 'unsupported_grant_type', 400, $hint);
}
semble terriblement familier non?
J'ai ce problème aussi, actuellement à la recherche d'une solution sur le net –