{"_id":"@blitzritz/passport-microsoft","name":"@blitzritz/passport-microsoft","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@blitzritz/passport-microsoft","version":"1.0.0","description":"Microsoft [Graph] authentication strategy for Passport.","keywords":["passport","microsoft","graph","graph.microsoft.io","oauth","oauth 2.0","auth","api","authentication","sean fisher","seafish.io"],"repository":{"type":"git","url":"git://github.com/seanfisher/passport-microsoft.git"},"author":{"name":"Sean Fisher","email":"opensource@seafish.io","url":"https://seafish.io"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"main":"./lib/","dependencies":{"passport-oauth2":"1.6.1"},"engines":{"node":">= 0.4.0"},"devDependencies":{"eslint":"^8.13.0","eslint-config-airbnb-base":"^15.0.0","eslint-plugin-import":"^2.26.0"},"_id":"@blitzritz/passport-microsoft@1.0.0","gitHead":"ccbae1a3a291ba42d503a571347ffc5e63a2f4e0","bugs":{"url":"https://github.com/seanfisher/passport-microsoft/issues"},"homepage":"https://github.com/seanfisher/passport-microsoft#readme","_nodeVersion":"18.18.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-ZW7cCcP6+dpnxeUcN7tNixm2eJ/XXEeWAGO6gq7vHtVEjdAOrSFTi66d6mNqYk6cOiz6TKnx4r1pnB6kwD+3vQ==","shasum":"b67fa5abd0d97d2b2fa282b0e2c2b878e4cf1df4","tarball":"https://registry.npmjs.org/@blitzritz/passport-microsoft/-/passport-microsoft-1.0.0.tgz","fileCount":17,"unpackedSize":51531,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDa5s1QgbiSVFC6Yiwkaf7GJEVSs/O1231vpDZfwRdypQIhAJer43/hFSp0vLeOCmE/yq2Vr38BQ5/Siga43FkL3ZUl"}]},"_npmUser":{"name":"blitzritz","email":"blitzritz@gmail.com"},"directories":{},"maintainers":[{"name":"blitzritz","email":"blitzritz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/passport-microsoft_1.0.0_1709440747106_0.1822429542488282"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-03T04:39:06.994Z","1.0.0":"2024-03-03T04:39:07.261Z","modified":"2024-03-03T04:39:08.027Z"},"maintainers":[{"name":"blitzritz","email":"blitzritz@gmail.com"}],"description":"Microsoft [Graph] authentication strategy for Passport.","homepage":"https://github.com/seanfisher/passport-microsoft#readme","keywords":["passport","microsoft","graph","graph.microsoft.io","oauth","oauth 2.0","auth","api","authentication","sean fisher","seafish.io"],"repository":{"type":"git","url":"git://github.com/seanfisher/passport-microsoft.git"},"author":{"name":"Sean Fisher","email":"opensource@seafish.io","url":"https://seafish.io"},"bugs":{"url":"https://github.com/seanfisher/passport-microsoft/issues"},"readme":"# Passport-microsoft\n\n[Passport](https://github.com/jaredhanson/passport) strategy for authenticating\nwith [Microsoft Graph](https://graph.microsoft.io/) using the OAuth 2.0 API.\n\nThis module lets you authenticate using Microsoft, in your Node.js applications.  \nBy plugging into Passport, Microsoft authentication can be easily and unobtrusively\nintegrated into any application or framework that supports [Connect](http://www.senchalabs.org/connect/)-style\nmiddleware, including [Express](http://expressjs.com/).\n\n## Install\n\nInstall via [npm](https://www.npmjs.com/package/passport-microsoft)\n\n    $ npm install passport-microsoft\n\n## Usage\n\n#### Configure Strategy\n\nThe microsoft authentication strategy authenticates users using a microsoft account and OAuth 2.0 tokens.  The strategy requires a `verify` callback, which\naccepts these credentials and calls `done` providing a user, as well as\n`options` specifying a client ID, client secret, and callback URL.\n\nThe consumer key and secret are obtained by [creating an application](https://apps.dev.microsoft.com/#/appList) at\nMicrosoft's developer site.\n\n```js\n    var MicrosoftStrategy = require('passport-microsoft').Strategy;\n    passport.use(new MicrosoftStrategy({\n        // Standard OAuth2 options\n        clientID: 'applicationidfrommicrosoft',\n        clientSecret: 'applicationsecretfrommicrosoft',\n        callbackURL: \"http://localhost:3000/auth/microsoft/callback\",\n        scope: ['user.read'],\n\n        // Microsoft specific options\n\n        // [Optional] The tenant for the application. Defaults to 'common'. \n        // Used to construct the authorizationURL and tokenURL\n        tenant: 'common',\n\n        // [Optional] The authorization URL. Defaults to `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/authorize`\n        authorizationURL: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',\n\n        // [Optional] The token URL. Defaults to `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/token`\n        tokenURL: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',\n      },\n      function(accessToken, refreshToken, profile, done) {\n        User.findOrCreate({ userId: profile.id }, function (err, user) {\n          return done(err, user);\n        });\n      }\n    ));\n```\n\n#### Authenticate Requests\n\nUse `passport.authenticate()`, specifying the `'microsoft'` strategy, to\nauthenticate requests.\n\nFor example, as route middleware in an [Express](http://expressjs.com/)\napplication:\n\n```js\n    app.get('/auth/microsoft',\n      passport.authenticate('microsoft', {\n        // Optionally define any authentication parameters here\n        // For example, the ones in https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow\n        \n        prompt: 'select_account',\n      }));\n\n    app.get('/auth/microsoft/callback', \n      passport.authenticate('microsoft', { failureRedirect: '/login' }),\n      function(req, res) {\n        // Successful authentication, redirect home.\n        res.redirect('/');\n      });\n```\n\n## Examples\n\nFor a complete, working example, refer to the [login example](https://github.com/seanfisher/passport-microsoft/tree/master/example/login).\n\n## Credits\n\n  - [Sean Fisher](https://www.seafish.io) - [passport-microsoft on Github](https://github.com/seanfisher/passport-microsoft)\n  - [Sluggy Bear](http://github.com/slugbay) - Original [Microsoft OneDrive](https://github.com/slugbay/passport-onedrive) strategy, upon which this is based\n\n  Copyright (c) 2022 Sean Fisher <[seafish.io](https://www.seafish.io)>\n\n## Thanks\n\n  - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n  - [The MIT License](http://opensource.org/licenses/MIT)\n","readmeFilename":"README.md"}