【问题标题】:Need Fix For That Error { Redirect URI must be absolute }需要修复该错误{重定向 URI 必须是绝对的}
【发布时间】:2020-07-01 12:53:04
【问题描述】:
public function setRedirectUri($uri)
{
    if (is_null($uri)) {
        $this->redirectUri = null;

        return;
    }
    // redirect URI must be absolute
    if (!$this->isAbsoluteUri($uri)) {
        // "postmessage" is a reserved URI string in Google-land
        // @see https://developers.google.com/identity/sign-in/web/server-side-flow
        if ('postmessage' !== (string)$uri) {
            throw new InvalidArgumentException(
                'Redirect URI must be absolute');
        }
    }
    $this->redirectUri = (string)$uri;
}
An uncaught Exception was encountered
Type: InvalidArgumentException

Message: Redirect URI must be absolute

Filename: /home/fhnm4mkw4lqa/public_html/application/third_party/google-api-client/vendor/google/auth/src/OAuth2.php

Line Number: 745

【问题讨论】:

    标签: redirect uri absolute


    【解决方案1】:

    您的if (!$this->isAbsoluteUri($uri)) 条件仅在输入的 URL 不是绝对的情况下才会继续,但是,忽略该部分,我能够通过以下方式解决我的错误:

    我的 URL 是这样格式化的,我得到了同样的错误: localhost/CalculatorApp/redirectTest

    现在我所要做的就是在 URL 前面添加 http://,这样它就会如下所示: http://localhost/CalculatorApp/redirectTest

    我也在使用 Google API,这解决了我的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-06
      • 2020-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-17
      • 1970-01-01
      • 2013-03-20
      相关资源
      最近更新 更多