Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:支持企微新版登录 #2854

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading