【问题标题】:The resource owner or authorization server denied the request资源所有者或授权服务器拒绝了请求
【发布时间】:2019-09-05 05:57:13
【问题描述】:

我有一个使用 Laravel 作为后端的 iPhone 应用程序,它必须在应用商店中发布,但应用商店拒绝了该应用,因为它们出现以下错误:

资源所有者或授权服务器拒绝了该请求。 {“异常”:“[对象] (League\OAuth2\Server\Exception\OAuthServerException(代码:9): 资源所有者或授权服务器拒绝了该请求。在 /var/www/mednfit/vendor/league/oauth2-server/src/Exception/OAuthServerException.php:205)

但我没有这个错误。这是什么意思?

【问题讨论】:

  • 首先在邮递员中检查 api,如果你得到正确的响应,那么它是你的设备错误,你没有正确设置所需的属性或令牌

标签: php ios laravel api


【解决方案1】:

此异常与过期的访问令牌有关。

您可以将\League\OAuth2\Server\Exception\OAuthServerException::class 添加到app/Exceptions/Handler.php 中的$dontReport 数组中。但是,这将阻止记录所有 OAuthServerException 异常,即使是那些与您过期的访问令牌无关的异常。

来源: Laracasts: Error Log Problems When Using Laravel Passport for User Login AuthenticationError Log Problems When Using Laravel Passport for User Login Authentication

【讨论】:

  • 谢谢...虽然在将OAuthServerException::class 添加到$dontReport 数组后我仍然收到异常日志。但是,Laracasts 的解决方案确实解决了这个问题。适用于 Laravel 5.5。
  • 如果有人在修改后遇到问题,请检查laracasts.com/discuss/channels/laravel/…
【解决方案2】:

与您登录时相同的错误消息仍然可以。你可以在composer.json试试这个

"laravel/passport": "9.0.0",
"lcobucci/jwt": "3.4.5",
"league/oauth2-server": "8.1.3",

【讨论】:

    【解决方案3】:

    只是在产品上运行

    composer dump-autoload
    php artisan optimize:clear
    

    【讨论】:

    • 我不确定您是否应该在不解释这些命令的作用的情况下提出建议。特别是考虑到你说 just run on prod....
    猜你喜欢
    • 2021-10-19
    • 1970-01-01
    • 1970-01-01
    • 2018-12-23
    • 2014-07-26
    • 1970-01-01
    • 2013-10-24
    • 1970-01-01
    • 2017-06-18
    相关资源
    最近更新 更多