Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/doylemark/passport-vatsim
- Owner: doylemark
- License: mit
- Created: 2021-06-13T01:50:54.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-06-13T13:31:22.000Z (over 3 years ago)
- Last Synced: 2024-12-19T13:49:36.337Z (16 days ago)
- Language: TypeScript
- Size: 80.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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";
```