From cfb16d5976f96fb7c09adc0ae7d3776f9c8be2b9 Mon Sep 17 00:00:00 2001 From: justmd5 Date: Thu, 16 May 2024 11:42:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E5=85=BC=E5=AE=B9=E6=80=A7?= =?UTF-8?q?=EF=BC=8C=E7=A7=BB=E5=8A=A8=E7=AB=AF=E7=BD=91=E9=A1=B5=E6=8E=88?= =?UTF-8?q?=E6=9D=83=EF=BC=8C=E6=8E=88=E6=9D=83url=E5=A6=82=E6=9E=9Cview?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=EF=BC=8Cview=E7=9B=B4=E6=8E=A5=E8=B5=8B?= =?UTF-8?q?=E5=80=BCh5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Oauth/PreAuth.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Oauth/PreAuth.php b/src/Oauth/PreAuth.php index 68dcfb3..040f092 100755 --- a/src/Oauth/PreAuth.php +++ b/src/Oauth/PreAuth.php @@ -57,15 +57,19 @@ private function accessToken() */ public function authorizationUrl(string $state = null, string $view = null): string { + $memberType = strtoupper($this->app->getConfig('member_type')); + if (!array_key_exists($memberType, static::AUTHORIZE_API_ARR)) { + throw new \InvalidArgumentException('Invalid member type'); + } return sprintf( '%s?%s', - static::AUTHORIZE_API_ARR[strtoupper($this->app->getConfig('member_type'))], + static::AUTHORIZE_API_ARR[$memberType], http_build_query([ 'client_id' => $this->accessToken()->getClientId(), 'response_type' => 'code', 'state' => $state, 'redirect_uri' => $this->accessToken()->getRedirectUri(), - 'view' => $view, + 'view' => $memberType === 'H5' ? 'h5' : $view, ]) ); }