passport-sharepoint-addin
v0.1.0
Published
Passport.js authentication middleware for SharePoint add-in
Downloads
6
Maintainers
Readme
Passport.js authentication middleware for SharePoint add-in
Passport.js authentication strategy for SharePoint Online and SharePoint on-premise performing authentication via ACS.
This module allows you to perform SharePoint add-in authentication for your Node.js Express web application. Can be also integrated into other connect-based frameworks.
Install
npm install passport-sharepoint-addin
Usage
For detailed in-depth tutorial and configuration workflow please visit sample here - Express SharePoint add-in sample.
Basic setup
passport.use(new SharePointAddinStrategy({clientId: '', clientSecret: ''}, 'https://site.com/auth/sharepoint/callback', (profile: ISharePointProfile) => {
return User.findOne({ 'sharepoint.loginName': profile.loginName })
.then(user => {
if (user) {
return user;
}
const newUser = new User();
newUser.sharepoint.email = profile.email;
newUser.sharepoint.loginName = profile.loginName;
newUser.sharepoint.displayName = profile.displayName;
return newUser.save();
});
}));