Skip to content

Commit

Permalink
Update README.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed Dec 1, 2011
1 parent 5623e0a commit d2cfe49
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 5 deletions.
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,57 @@
# Passport-Yahoo

[Passport](https://github.com/jaredhanson/passport) strategy for authenticating
with [Yahoo](http://www.yahoo.com/) using OpenID 2.0.
with [Yahoo!](http://www.yahoo.com/) using OpenID 2.0.

## Installation

$ npm install passport-yahoo

## Usage

#### Configure Strategy

The Yahoo authentication strategy authenticates users using a Yahoo account,
which is also an OpenID 2.0 identifier. The strategy requires a `validate`
callback, which accepts this identifier and calls `done` providing a user.
Additionally, options can be supplied to specify a return URL and realm.

passport.use(new YahooStrategy({
returnURL: 'http://localhost:3000/auth/yahoo/return',
realm: 'http://localhost:3000/'
},
function(identifier, done) {
User.findByOpenID({ openId: identifier }, function (err, user) {
return done(err, user);
});
}
));

#### Authenticate Requests

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

For example, as route middleware in an [Express](http://expressjs.com/)
application:

app.get('/auth/yahoo',
passport.authenticate('yahoo'),
function(req, res){
// The request will be redirected to Yahoo for authentication, so
// this function will not be called.
});

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

#### Examples

For a complete, working example, refer to the [signon example](https://github.com/jaredhanson/passport-yahoo/tree/master/examples/signon).

## Credits

Expand Down
3 changes: 0 additions & 3 deletions examples/signon/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ passport.use(new YahooStrategy({
realm: 'http://localhost:3000/'
},
function(identifier, profile, done) {
console.log('YAHOO ID: ' + identifier);
console.log('YAHOO PROFILE: ' + util.inspect(profile));

// asynchronous verification, for effect...
process.nextTick(function () {

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "passport-yahoo",
"version": "0.1.0",
"description": "Yahoo authentication strategy for Passport.",
"description": "Yahoo! authentication strategy for Passport.",
"author": "Jared Hanson <jaredhanson@gmail.com> (http://www.jaredhanson.net/)",
"repository": {
"type": "git",
Expand Down

0 comments on commit d2cfe49

Please sign in to comment.