Skip to content

Commit

Permalink
feat:支持企微新版登录 (#2854)
Browse files Browse the repository at this point in the history
  • Loading branch information
jatyPeng authored Nov 16, 2024
1 parent 4e6e576 commit 6e905be
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/OpenWork/Provider/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ public function __construct(ServiceContainer $app)
* @param string $redirectUri
* @param string $userType
* @param string $state
* @param bool $serviceWwlogin
*
* @return string
*/
public function getLoginUrl(string $redirectUri = '', string $userType = 'admin', string $state = '')
public function getLoginUrl(string $redirectUri = '', string $userType = 'admin', string $state = '', bool $serviceWwlogin = false)
{
$redirectUri || $redirectUri = $this->app->config['redirect_uri_single'];
$state || $state = random_bytes(64);
Expand All @@ -52,6 +53,13 @@ public function getLoginUrl(string $redirectUri = '', string $userType = 'admin'
'state' => $state,
];

// 新版企微登录
if ($serviceWwlogin) {
$params['appid'] = $this->app['config']['suite_id'];
$params['login_type'] = 'ServiceApp';
return 'https://login.work.weixin.qq.com/wwlogin/sso/login?'.http_build_query($params);
}

return 'https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?'.http_build_query($params);
}

Expand Down

0 comments on commit 6e905be

Please sign in to comment.