passport-sharepoint-addin
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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();
            });
    }));

Dependents (0)

Package Sidebar

Install

npm i passport-sharepoint-addin

Weekly Downloads

1

Version

0.1.0

License

none

Last publish

Collaborators

  • s-kainet