Socket
Book a DemoInstallSign in
Socket

passport-odesk

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-odesk

Odesk authentication strategy for Passport.

0.0.10
latest
Source
npmnpm
Version published
Maintainers
2
Created
Source

Passport-Odesk

Passport strategy for authenticating with Odesk using the OAuth 1.0a API.

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

Install

$ npm install passport-odesk

Usage

Configure Strategy

We need to get this keyes from Odesk api. For example, I used this values:

passport.use(new OdeskStrategy({
    consumerKey: 'f448b92c4aaf8918c0106bd164a1656',
    consumerSecret: 'e6a71b4f05467054',
    callbackURL: "http://127.0.0.1:3000/auth/odesk/callback"
  },
  function(token, tokenSecret, profile, done) {
    User.findOrCreate({ id: profile.id }, function (err, user) {
      return done(err, user);
    });
  }
));

Authenticate Requests

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

For example, as route middleware in an Express application:

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

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

Examples

For a complete, working example, refer to the signin example.

Odesk Data Example


    {
        provider: 'odesk',
        id: 'John_Doe',
        name: { familyName: 'Doe', givenName: 'John' },
        ref: '3603850',
        displayName: 'John Doe',
        img: 'https://odesk-prod-portraits.s3.amazonaws.com/Users:johnDoe:PortraitUrl_50?AWSAccessKeyId=1XVAX3FNQZAFC9GJCFR2&Expires=2147483647&Signature=P7XYYyZr9c%2Bvv%2F25voKeTg92eFc%3D',
        country: 'Russia',
        profile: 'https://www.odesk.com/users/~johnDoe',
        emails: [ { value: 'JohnDoe@odesk.com', type: 'work' } ],
        timezone: 'Europe/Klin',
        timezone_offset: '14400',
        location: { city: 'Klin', state: '', country: 'Russia' },
        company_url: 'http://example.com'
    }

Tests

Install vows first

    $ npm install vows
    $ npm test

Build status - Build Status

Credits

License

The MIT License

Copyright (c) 2011-2013 Ostroumov Anatolij <http://teksi.ru/resume/>

Based on Plugin <https://github.com/jaredhanson/passport-twitter> by Jared Hanson <http://jaredhanson.net/>

Keywords

passport

FAQs

Package last updated on 17 Jun 2013

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.