https://github.com/prolincur/passport-forge
Autodesk Forge OAuth 2.0 authorization (three-legged) strategy for Passport.
https://github.com/prolincur/passport-forge
Last synced: 2 months ago
JSON representation
Autodesk Forge OAuth 2.0 authorization (three-legged) strategy for Passport.
- Host: GitHub
- URL: https://github.com/prolincur/passport-forge
- Owner: prolincur
- License: mit
- Created: 2020-09-20T07:26:13.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-15T15:51:23.000Z (about 4 years ago)
- Last Synced: 2025-03-18T11:12:39.154Z (3 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/passport-forge
- Size: 10.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# passport-forge
Autodesk Forge three-legged authentication strategy for [Passport](http://passportjs.org/).
This module lets you authenticate with Autodesk Forge using OAuth 2.0 in your
Node.js applications.## Install
$ npm install passport-forge
## Usage
#### Configure Strategy
The Autodesk Forge three-legged authentication strategy authenticates users using
a third-party account and OAuth 2.0 tokens. The provider's client identifer and secret,
are specified as options. The strategy requires a `verify` callback,
which receives an access token and profile, and calls `done` providing a user.
`var ForgeOAuth2Strategy = require('passport-forge').Strategypassport.use(new ForgeOAuth2Strategy({
authorizationURL: 'https://developer.api.autodesk.com/authentication/v1/authenticate',
tokenURL: 'https://developer.api.autodesk.com/authentication/v1/getToken',
clientID: EXAMPLE_CLIENT_ID,
clientSecret: EXAMPLE_CLIENT_SECRET,
callbackURL: 'http://localhost:3000/auth/example/callback',
scopes: 'data:read'
},
function(accessToken, refreshToken, profile, done) {
User.findOrCreate({ exampleId: profile.id }, function (err, user) {
return done(err, user);
});
}
));`#### Authenticate Requests
Use `passport.authenticate()`, specifying the `'forge'` strategy, to
authenticate requests.For example, as route middleware in an [Express](http://expressjs.com/)
application:`app.get('/auth/example',
passport.authenticate('forge'));app.get('/auth/example/callback',
passport.authenticate('forge', { failureRedirect: '/login' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/');
});`## Related Modules
- [passport-oauth2](https://github.com/jaredhanson/passport-oauth2) — OAuth 2.0 authentication strategy
- [OAuth2orize](https://github.com/jaredhanson/oauth2orize) — OAuth 2.0 authorization server toolkit## Tests
$ npm install
## License
[The MIT License](http://opensource.org/licenses/MIT)
### Author
[Sourabh Soni](https://prolincur.com)\
[Prolincur Technologies](https://prolincur.com)