Skip to content

Commit

Permalink
增强兼容性,移动端网页授权,授权url如果view为空,view直接赋值h5
Browse files Browse the repository at this point in the history
  • Loading branch information
justmd5 committed May 16, 2024
1 parent 86e5bcb commit cfb16d5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Oauth/PreAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
])
);
}
Expand Down

0 comments on commit cfb16d5

Please sign in to comment.