|
|
|
@ -163,6 +163,7 @@ const initializePassport = async () => {
|
|
|
|
|
clientID: clientIdGitHubLogin,
|
|
|
|
|
clientSecret: clientSecretGitHubLogin,
|
|
|
|
|
callbackURL: "/api/v1/sso/github",
|
|
|
|
|
accessType: 'offline',
|
|
|
|
|
scope: ["user:email"]
|
|
|
|
|
},
|
|
|
|
|
async (req : express.Request, accessToken : any, refreshToken : any, profile : any, done : any) => {
|
|
|
|
@ -174,7 +175,7 @@ const initializePassport = async () => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const { data }: { data: GitHubEmail[] } = await standardRequest.get(
|
|
|
|
|
`${INTEGRATION_GITHUB_API_URL}/user/emails`,
|
|
|
|
|
`https://git.cereg.com/api/v1/user/emails`,
|
|
|
|
|
{
|
|
|
|
|
headers: {
|
|
|
|
|
Authorization: `Bearer ${accessToken}`
|
|
|
|
@ -237,6 +238,7 @@ const initializePassport = async () => {
|
|
|
|
|
clientID: clientIdGitLabLogin,
|
|
|
|
|
clientSecret: clientSecretGitLabLogin,
|
|
|
|
|
callbackURL: "/api/v1/sso/gitlab",
|
|
|
|
|
accessType: 'offline',
|
|
|
|
|
baseURL: urlGitLab
|
|
|
|
|
},
|
|
|
|
|
async (req : express.Request, accessToken : any, refreshToken : any, profile : any, done : any) => {
|
|
|
|
@ -255,6 +257,10 @@ const initializePassport = async () => {
|
|
|
|
|
}).save();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(">>>>>>accessToken",accessToken);
|
|
|
|
|
console.log(">>>>>>refreshToken",refreshToken);
|
|
|
|
|
console.log(">>>>>>profile",profile);
|
|
|
|
|
|
|
|
|
|
let isLinkingRequired = false;
|
|
|
|
|
if (!user.authMethods.includes(AuthMethod.GITLAB)) {
|
|
|
|
|
isLinkingRequired = true;
|
|
|
|
|