-
Anonymous
Filsh oauth2 в yii2 (получение исключения)
Сообщение
Anonymous »
Я пытаюсь реализовать filsh oauth2 в yii2. Но я понимаю
Код: Выделить всё
{
"name": "Exception",
"message": "Argument 1 passed to OAuth2\\GrantType\\ClientCredentials::__construct() must implement interface OAuth2\\Storage\\ClientCredentialsInterface, instance of common\\auth\\Identity given",
"code": 0,
"type": "TypeError",
"file": "C:\\xampp\\htdocs\\warehouse\\vendor\\bshaffer\\oauth2-server-php\\src\\OAuth2\\GrantType\\ClientCredentials.php",
"line": 25,
"stack-trace": [
"#0 [internal function]: OAuth2\\GrantType\\ClientCredentials->__construct(Object(common\\auth\\Identity), Array)",
"#1 C:\\xampp\\htdocs\\warehouse\\vendor\\filsh\\yii2-oauth2-server\\Module.php(95): ReflectionClass->newInstanceArgs(Array)",
"#2 C:\\xampp\\htdocs\\warehouse\\vendor\\filsh\\yii2-oauth2-server\\controllers\\RestController.php(25): filsh\\yii2\\oauth2server\\Module->getServer()",
"#3 [internal function]: filsh\\yii2\\oauth2server\\controllers\\RestController->actionToken()",
"#4 C:\\xampp\\htdocs\\warehouse\\vendor\\yiisoft\\yii2\\base\\InlineAction.php(57): call_user_func_array(Array, Array)",
"#5 C:\\xampp\\htdocs\\warehouse\\vendor\\yiisoft\\yii2\\base\\Controller.php(157): yii\\base\\InlineAction->runWithParams(Array)",
"#6 C:\\xampp\\htdocs\\warehouse\\vendor\\yiisoft\\yii2\\base\\Module.php(528): yii\\base\\Controller->runAction('token', Array)",
"#7 C:\\xampp\\htdocs\\warehouse\\vendor\\yiisoft\\yii2\\web\\Application.php(103): yii\\base\\Module->runAction('oauth2/rest/tok...', Array)",
"#8 C:\\xampp\\htdocs\\warehouse\\vendor\\yiisoft\\yii2\\base\\Application.php(386): yii\\web\\Application->handleRequest(Object(yii\\web\\Request))",
"#9 C:\\xampp\\htdocs\\warehouse\\api\\web\\index.php(17): yii\\base\\Application->run()",
"#10 {main}"
]
}
Когда я пытаюсь отправить свои данные POST, чтобы получить токен доступа:
{"grant_type" => "password","username" => "indigo","password" => "qwerty","client_id" => "testclient", "client_secret" => "testpass"}
[img]https://i.sstatic.net/WHjLb.png[/img]
Вот мой API/config/main.php
Подробнее здесь: [url]https://stackoverflow.com/questions/47791055/filsh-oauth2-in-yii2getting-exception[/url]
1721884989
Anonymous
Я пытаюсь реализовать filsh oauth2 в yii2. Но я понимаю
[code]{
"name": "Exception",
"message": "Argument 1 passed to OAuth2\\GrantType\\ClientCredentials::__construct() must implement interface OAuth2\\Storage\\ClientCredentialsInterface, instance of common\\auth\\Identity given",
"code": 0,
"type": "TypeError",
"file": "C:\\xampp\\htdocs\\warehouse\\vendor\\bshaffer\\oauth2-server-php\\src\\OAuth2\\GrantType\\ClientCredentials.php",
"line": 25,
"stack-trace": [
"#0 [internal function]: OAuth2\\GrantType\\ClientCredentials->__construct(Object(common\\auth\\Identity), Array)",
"#1 C:\\xampp\\htdocs\\warehouse\\vendor\\filsh\\yii2-oauth2-server\\Module.php(95): ReflectionClass->newInstanceArgs(Array)",
"#2 C:\\xampp\\htdocs\\warehouse\\vendor\\filsh\\yii2-oauth2-server\\controllers\\RestController.php(25): filsh\\yii2\\oauth2server\\Module->getServer()",
"#3 [internal function]: filsh\\yii2\\oauth2server\\controllers\\RestController->actionToken()",
"#4 C:\\xampp\\htdocs\\warehouse\\vendor\\yiisoft\\yii2\\base\\InlineAction.php(57): call_user_func_array(Array, Array)",
"#5 C:\\xampp\\htdocs\\warehouse\\vendor\\yiisoft\\yii2\\base\\Controller.php(157): yii\\base\\InlineAction->runWithParams(Array)",
"#6 C:\\xampp\\htdocs\\warehouse\\vendor\\yiisoft\\yii2\\base\\Module.php(528): yii\\base\\Controller->runAction('token', Array)",
"#7 C:\\xampp\\htdocs\\warehouse\\vendor\\yiisoft\\yii2\\web\\Application.php(103): yii\\base\\Module->runAction('oauth2/rest/tok...', Array)",
"#8 C:\\xampp\\htdocs\\warehouse\\vendor\\yiisoft\\yii2\\base\\Application.php(386): yii\\web\\Application->handleRequest(Object(yii\\web\\Request))",
"#9 C:\\xampp\\htdocs\\warehouse\\api\\web\\index.php(17): yii\\base\\Application->run()",
"#10 {main}"
]
}
Когда я пытаюсь отправить свои данные POST, чтобы получить токен доступа:
{"grant_type" => "password","username" => "indigo","password" => "qwerty","client_id" => "testclient", "client_secret" => "testpass"}
[img]https://i.sstatic.net/WHjLb.png[/img]
Вот мой API/config/main.php
Подробнее здесь: [url]https://stackoverflow.com/questions/47791055/filsh-oauth2-in-yii2getting-exception[/url]