Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

ARTIK Cloud authentication strategy for Passport and Node.js.

License

Notifications You must be signed in to change notification settings

webispy/passport-artikcloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

passport-artikcloud

Passport strategy for authenticating with ARTIK Cloud using the OAuth 2.0 API.

Install

$ npm install passport-artikcloud

Usage

Configure Strategy

passport.use(new ARTIKCloudStrategy({
    clientID: EXAMPLE_CLIENT_ID,
    clientSecret: EXAMPLE_CLIENT_SECRET,
    callbackURL: "http://localhost:3000/auth/example/callback"
  },
  function(accessToken, refreshToken, profile, cb) {
    User.findOrCreate({ exampleId: profile.id }, function (err, user) {
      return cb(err, user);
    });
  }
));

Authenticate Requests

app.get('/auth/example',
  passport.authenticate('artikcloud'));

app.get('/auth/example/callback',
  passport.authenticate('artikcloud', { failureRedirect: '/login' }),
  function(req, res) {
    // Successful authentication, redirect home.
    res.redirect('/');
  });

License

The MIT License

Copyright (c) 2016 Inho Oh webispy@gmail.com

About

ARTIK Cloud authentication strategy for Passport and Node.js.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published