feat: add wecom provider (#200)

Signed-off-by: sh1luo <690898835@qq.com>
This commit is contained in:
sh1luo
2021-07-28 20:36:27 +08:00
committed by GitHub
parent c9ae582802
commit 512a451800
6 changed files with 210 additions and 1 deletions

View File

@ -75,6 +75,7 @@ class ProviderEditPage extends React.Component {
{id: 'Weibo', name: 'Weibo'},
{id: 'Gitee', name: 'Gitee'},
{id: 'LinkedIn', name: 'LinkedIn'},
{id: 'WeCom', name: 'WeCom'},
]
);
} else if (provider.category === "Email") {

View File

@ -51,6 +51,10 @@ const LinkedInAuthScope = "r_liteprofile%20r_emailaddress";
const LinkedInAuthUri = "https://www.linkedin.com/oauth/v2/authorization";
const LinkedInAuthLogo = `${StaticBaseUrl}/img/social_linkedin.png`;
// const WeComAuthScope = "";
const WeComAuthUri = "https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect";
const WeComAuthLogo = `${StaticBaseUrl}/img/social_wecom.png`;
export function getAuthLogo(provider) {
if (provider.type === "Google") {
return GoogleAuthLogo;
@ -70,6 +74,8 @@ export function getAuthLogo(provider) {
return GiteeAuthLogo;
} else if (provider.type === "LinkedIn") {
return LinkedInAuthLogo;
} else if (provider.type === "WeCom") {
return WeComAuthLogo;
}
}
@ -98,5 +104,7 @@ export function getAuthUrl(application, provider, method) {
return `${GiteeAuthUri}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${GiteeAuthScope}&response_type=code&state=${state}`;
} else if (provider.type === "LinkedIn") {
return `${LinkedInAuthUri}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${LinkedInAuthScope}&response_type=code&state=${state}`
} else if (provider.type === "WeCom") {
return `${WeComAuthUri}?appid=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&usertype=member`
}
}