Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/doylemark/passport-vatsim

VATSIM auth with passport.js
https://github.com/doylemark/passport-vatsim

Last synced: 12 days ago
JSON representation

VATSIM auth with passport.js

Awesome Lists containing this project

README

        

# passport-vatsim

oauth2 middleware for [vatsim connect](https://github.com/vatsimnetwork/developer-info/wiki/Connect) using passport.js and express

example usage in [example](./example/app.ts)

installation:

* `npm install @vatsim/passport-vatsim`

```js
import vatsim from "@vatsim/passport-vatsim";

const config = { clientID, clientSecret, callbackURL, scope };

const handler = (accessToken, refreshToken, profile, callback) => {
const user = db.findOrCreate({ id: profile.cid });
return callback(null, user);
}

passport.use(vatsim(config, handler));
```

```js
app.get("/", passport.authenticate("vatsim"), (req, res) => ...)
```

### Typescript
You can also import the user profile type
```js
import vatsim, { Profile } from "@vatsim/passport-vatsim";
```