Socket
Socket
Sign inDemoInstall

passport-wolkeneis

Package Overview
Dependencies
6
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    passport-wolkeneis

Passport strategy for authentication with Wolkeneis (wolkeneis.dev), based on passport-discord


Version published
Maintainers
1
Created

Readme

Source

CodeFactor

passport-wolkeneis

Passport strategy for authenticating with Wolkeneis using the OAuth 2.0 API.

This module lets you authenticate using Wolkeneis in your Node.js applications. By plugging into Passport, Wolkeneis authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.

Install

npm install passport-wolkeneis

Usage

Create an Application

Before using passport-wolkeneis, you must register an application with Wolkeneis. If you have not already done so, a new application can be created at Wolkeneis Account Management. Your application will be issued a Client Identifier and Client Secret, which need to be provided to the strategy. You will also need to configure a callback URL which matches the route in your application.

Configure Strategy

The Wolkeneis authentication strategy authenticates users via a Wolkeneis user account and OAuth 2.0 token(s). A Wolkeneis API client ID, secret and redirect URL must be supplied when using this strategy. The strategy also requires a verify callback, which receives the access token and an optional refresh token, as well as a profile which contains the authenticated Wolkeneis user's profile. The verify callback must also call done providing a user to complete the authentication.

var WolkeneisStrategy = require('passport-wolkeneis').Strategy;

var scope = 'identify';

passport.use(new WolkeneisStrategy({
  clientID: 'id',
  clientSecret: 'secret',
  callbackURL: 'https://www.example.com/authenticate/wolkeneis/callback',
  scope: scope
},
function(accessToken, refreshToken, profile, done) {
  User.findOrCreate({ wolkeneisUserId: profile.id }, function(error, user) {
    return done(error, user);
  });
}));
Authenticate Requests

Use passport.authenticate(), and specify the 'wolkeneis' strategy to authenticate requests.

For example, as a route middleware in an Express app:

app.get('/authenticate/wolkeneis', passport.authenticate('wolkeneis'));
app.get('/authenticate/wolkeneis/callback', passport.authenticate('wolkeneis', {
  failureRedirect: '/',
}), function(req, res) {
  res.redirect('/secretstuff') // Successful auth
});

or

app.get('/authenticate/wolkeneis', passport.authenticate('wolkeneis'));
app.get('/authenticate/wolkeneis/callback', passport.authenticate('wolkeneis', {
  failureRedirect: '/',
  successReturnToOrRedirect: '/secretstuff', // Successful auth
}));

Examples

An Express server example can be found in the /example directory. Be sure to npm install in that directory to get the dependencies.

Credits

  • Nicholas Tay - used passport-discord as a base.
  • Jared Hanson - used passport-oauth2, passport-twitter and passport-facebook to understand Passport Strategies better.

License

Licensed under the ISC license. The full license text can be found in the root of the project repository.

Keywords

FAQs

Last updated on 14 May 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc