Skip to content

mithya-team/clever-passport

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This package is no longer maintained.

The packaged live on NPM is NOT maintained by me and the code for it could change at any time (if the owner of it decided to change something in the code)


clever-passport

Passport strategy for Instant Login with Clever

This module is a version of raclim's passport-clever, with tons of bug fixes.

Installation

Install the package via npm: npm install clever-passport

Usage

Requirements

To use this module, you will need a Clever Developer Account . Then create an application and retrieve/fill out the following: clientID, clientSecret, and redirect URIs (enter your redirect URIs).

Configuration

Initialize the strategy as follows:

const CleverStrategy = require('clever-passport').Strategy;
passport.use(new CleverStrategy({
    clientID: "<client id>",
    clientSecret: "<client secret>",
    callbackURL: "<callback url>",
    passReqToCallback: true
}, function(req, accessToken, refreshToken, profile, done) {
    User.findOrCreate({ cleverId: profile.data.id }, function(err, user) {
        return done(err, user);
}}));

Authenticate Requests

Use passport.authenticate() to authunicate the requests.

For example, you could implement it with Express like this:

app.get("/login", passport.authenticate("clever"));

app.get("/callback", passport.authenticate("clever", { failureRedirect: "/login" }),
  function(req, res) {
    res.redirect("/"); //redirect on successful authentication
});

Disclaimer

This repository is NOT developed or endorsed by Clever. This library is here to help users easily integrate Clever's Instant Login API to their Node.js projects. All questions about the API should be taken to Clever Support and all questions about this library should be taken to milanmdev.

About

Passport strategy for Instant Login with Clever

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%