change scope
This commit is contained in:
parent
565b7e547c
commit
cf48f6aa7d
1 changed files with 15 additions and 8 deletions
|
|
@ -6,7 +6,7 @@ const querystring = require("querystring");
|
|||
const clientId = "780w7gsy8eysmj";
|
||||
const clientSecret = "WPL_AP1.w6OTTkAndAdT3PYF.UZEcwQ==";
|
||||
const redirectUri = "http://localhost:4200/api/auth/linkedin/callback";
|
||||
const scope = "openid profile email";
|
||||
const scope = "r_liteprofile r_emailaddress";
|
||||
|
||||
let accessToken = "";
|
||||
|
||||
|
|
@ -46,18 +46,25 @@ const handleCallback = async (req, res) => {
|
|||
},
|
||||
});
|
||||
|
||||
const emailResponse = await axios.get("https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))", {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
});
|
||||
const emailResponse = await axios.get(
|
||||
"https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))",
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// Stocke dans la session
|
||||
req.session.user = {
|
||||
accessToken,
|
||||
nom: profileResponse.data.localizedFirstName + " " + profileResponse.data.localizedLastName,
|
||||
nom:
|
||||
profileResponse.data.localizedFirstName +
|
||||
" " +
|
||||
profileResponse.data.localizedLastName,
|
||||
img: profileResponse.data.profilePicture
|
||||
? profileResponse.data.profilePicture["displayImage~"].elements[0].identifiers[0].identifier
|
||||
? profileResponse.data.profilePicture["displayImage~"].elements[0]
|
||||
.identifiers[0].identifier
|
||||
: null,
|
||||
email: emailResponse.data.elements[0]["handle~"].emailAddress,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue