Passport strategy for authenticating with Cloudron using the OAuth API.

This module lets you authenticate using a Cloudron in your Node.js applications through the Passport library.


$ npm install passport-cloudron


var CloudronStrategy = require('passport-cloudron');

Configure Strategy

The Cloudron authentication strategy authenticates users using a Cloudron account and OAuth tokens. The strategy requires a verify callback, which receives the access token and corresponding secret as arguments, as well as profile which contains the authenticated user's Cloudron profile. The verify callback must call done providing a user to complete authentication.

In order to identify your application to the Cloudron, specify the clientID and clientSecret within options. These values are picked up automatically from the environment variables when using the oauth addon, so usually you don't have to provide them explicitly. See the addon documentation page for more information.

passport.use(new CloudronStrategy({
    callbackURL: process.env.APP_ORIGIN + '/auth/done'
  function verify(token, tokenSecret, profile, done) {
    User.findOrCreate({ id: }, function (err, user) {
      return done(err, user);

Authenticate Requests

Use passport.authenticate(), specifying the 'cloudron' strategy, to authenticate requests.

For example, as route middleware in an Express application:


  passport.authenticate('cloudron', { failureRedirect: '/login' }),
  function(req, res) {
    // Successful authentication, redirect home.