feat: add linkedin provider

Signed-off-by: wasabi <690898835@qq.com>
This commit is contained in:
wasabi
2021-07-03 20:53:38 +08:00
committed by Yang Luo
parent 6cfe3c1586
commit c963ba6098
5 changed files with 344 additions and 1 deletions

View File

@ -47,6 +47,10 @@ const GiteeAuthScope = "user_info,emails";
const GiteeAuthUri = "https://gitee.com/oauth/authorize";
const GiteeAuthLogo = `${StaticBaseUrl}/img/social_gitee.png`;
const LinkedInAuthScope = "r_liteprofile%20r_emailaddress";
const LinkedInAuthUri = "https://www.linkedin.com/oauth/v2/authorization";
const LinkedInAuthLogo = `${StaticBaseUrl}/img/social_linkedin.png`;
export function getAuthLogo(provider) {
if (provider.type === "Google") {
return GoogleAuthLogo;
@ -64,6 +68,8 @@ export function getAuthLogo(provider) {
return WeiboAuthLogo;
} else if (provider.type === "Gitee") {
return GiteeAuthLogo;
} else if (provider.type === "LinkedIn") {
return LinkedInAuthLogo;
}
}
@ -90,5 +96,7 @@ export function getAuthUrl(application, provider, method) {
return `${WeiboAuthUri}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${WeiboAuthScope}&response_type=code&state=${state}`;
} else if (provider.type === "Gitee") {
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}`
}
}