# passport-forge

> Autodesk Forge OAuth 2.0 authentication (three-legged) strategy for Passport.

Latest version **1.0.0** (published 2021-03-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install passport-forge
pnpm add passport-forge
yarn add passport-forge
bun add passport-forge
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-03-15 |
| First published | 2020-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 8.3 |
| Dependencies | 2 |
| Unpacked size | 14.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Sourabh Soni |
| Maintainers | prolincur |
| Keywords | passport, oauth2, authentication, forge |

## Links

- npm: https://www.npmjs.com/package/passport-forge
- Repository: https://github.com/prolincur/passport-forge
- Homepage: https://github.com/prolincur/passport-forge#readme
- Issues: https://github.com/prolincur/passport-forge/issues
- npm.io page: https://npm.io/package/passport-forge

## Dependencies (2)

- [utils-merge](https://npm.io/package/utils-merge.md) ^1.0.1
- [passport-oauth2](https://npm.io/package/passport-oauth2.md) ^1.5.0

## Alternatives

- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads
- [escher-request](https://npm.io/package/escher-request.md) — 545 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-03-15
- 0.0.3 — 2020-09-20
- 0.0.2 — 2020-09-20
- 0.0.1 — 2020-09-20

## 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').Strategy

    passport.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)

---
_Source: https://npm.io/package/passport-forge · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
