Permalink
Browse files

Document Strategy.

  • Loading branch information...
1 parent dbf4af6 commit 3fae68719ba40bb5422f70e5f2e60c25bbdf8e06 @jaredhanson committed Nov 4, 2011
Showing with 33 additions and 0 deletions.
  1. +33 −0 lib/passport-google/strategy.js
@@ -5,6 +5,39 @@ var util = require('util')
, OpenIDStrategy = require('passport-openid').Strategy;
+/**
+ * `Strategy` constructor.
+ *
+ * The Google authentication strategy authenticates requests by delegating to
+ * Google using the OpenID 2.0 protocol.
+ *
+ * Applications must supply a `validate` callback which accepts an `identifier`,
+ * and optionally a service-specific `profile`, and then calls the `done`
+ * callback supplying a `user`, which should be set to `false` if the
+ * credentials are not valid. If an exception occured, `err` should be set.
+ *
+ * Options:
+ * - `returnURL` URL to which Google will redirect the user after authentication
+ * - `realm` the part of URL-space for which an OpenID authentication request is valid
+ * - `profile` enable profile exchange, defaults to _true_
+ *
+ * Examples:
+ *
+ * passport.use(new GoogleStrategy({
+ * returnURL: 'http://localhost:3000/auth/google/return',
+ * realm: 'http://localhost:3000/'
+ * },
+ * function(identifier, profile, done) {
+ * User.findByOpenID(identifier, function (err, user) {
+ * done(err, user);
+ * });
+ * }
+ * ));
+ *
+ * @param {Object} options
+ * @param {Function} verify
+ * @api public
+ */
function Strategy(options, validate) {
options = options || {};
options.providerURL = options.providerURL || 'https://www.google.com/accounts/o8/id';

0 comments on commit 3fae687

Please sign in to comment.