Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update README.

  • Loading branch information...
commit d2cfe491e3fa4413e9a5e07cbd5d1b63289dad2f 1 parent 5623e0a
@jaredhanson authored
Showing with 52 additions and 5 deletions.
  1. +51 −1 README.md
  2. +0 −3  examples/signon/app.js
  3. +1 −1  package.json
View
52 README.md
@@ -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
View
3  examples/signon/app.js
@@ -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 () {
View
2  package.json
@@ -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",
Please sign in to comment.
Something went wrong with that request. Please try again.