Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merged upstream

  • Loading branch information...
commit a6b3f0e8be09d7e263139f34aaf13098d69c829a 2 parents a8d8d6f + 76b02c6
@slickplaid slickplaid authored
View
88 README.md
@@ -14,7 +14,8 @@ So far, `everyauth` enables you to login via:
- `yahoo`
- `readability`                             (Credits [Alfred Nerstu](https://github.com/alfrednerstu))
- `dropbox`                                    (Credits [Torgeir](https://github.com/torgeir))
- - `vimeo`                                    (Credits [slickplaid](https://github.com/slickplaid))
+ - `justin.tv`                                 (Credits [slickplaid](https://github.com/slickplaid))
+ - `vimeo`                                 (Credits [slickplaid](https://github.com/slickplaid))
- OAuth2
- `facebook`
- `github`
@@ -936,6 +937,87 @@ object whose parameter name keys map to description values:
everyauth.dropbox.configurable();
```
+## Setting up Justin.tv OAuth
+
+[Sign up for a Justin.tv account](http://www.justin.tv/user/signup) and activate it as a [developer account](http://www.justin.tv/developer/activate) to get your consumer key and secret.
+
+```javascript
+var everyauth = require('everyauth')
+ , connect = require('connect');
+
+everyauth.justintv
+ .consumerKey('YOUR CONSUMER KEY HERE')
+ .consumerSecret('YOUR CONSUMER SECRET HERE')
+ .findOrCreateUser( function (sess, accessToken, accessSecret, justintvUser) {
+ // find or create user logic goes here
+ //
+ // e.g.,
+ // return usersByJustintvId[justintvUser.id] || (usersByJustintvId[justintvUser.id] = justintvUser);
+ })
+ .redirectPath('/');
+
+var routes = function (app) {
+ // Define your routes here
+};
+
+connect(
+ connect.bodyParser()
+ , connect.cookieParser()
+ , connect.session({secret: 'whodunnit'})
+ , everyauth.middleware()
+ , connect.router(routes);
+).listen(3000);
+```
+
+The `justintvUser` parameter in the `.findOrCreateUser()` function above returns the `account/whoami` API call
+
+[Justin.tv API Wiki - Account/whoami](http://apiwiki.justin.tv/mediawiki/index.php/Account/whoami)
+
+```javascript
+{
+ "image_url_huge": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-320x240-4.jpg",
+ "profile_header_border_color": null,
+ "favorite_quotes": "I love Justin.tv",
+ "sex": "Male",
+ "image_url_large": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-125x94-4.jpg",
+ "profile_about": "Check out my website:\n\nwww.justin.tv\n",
+ "profile_background_color": null,
+ "image_url_medium": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-75x56-4.jpg",
+ "id": 1698,
+ "broadcaster": true,
+ "profile_url": "http:\/\/www.justin.tv\/justin\/profile",
+ "profile_link_color": null,
+ "image_url_small": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-50x37-4.jpg",
+ "profile_header_text_color": null,
+ "name": "The JUST UN",
+ "image_url_tiny": "http:\/\/static-cdn.justin.tv\/jtv_user_pictures\/justin-33x25-4.jpg",
+ "login": "justin",
+ "profile_header_bg_color": null,
+ "location": "San Francisco"
+}
+```
+
+You can also configure more parameters (most are set to defaults) via the same chainable API:
+
+```javascript
+everyauth.justintv
+ .entryPath('/auth/justintv')
+ .callbackPath('/auth/justintv/callback');
+```
+
+If you want to see what the current value of a configured parameter is, you can do so via:
+
+```javascript
+everyauth.justintv.callbackPath(); // '/auth/justintv/callback'
+everyauth.justintv.entryPath(); // '/auth/justintv'
+```
+
+To see all parameters that are configurable, the following will return an object whose parameter name keys map to description values:
+
+```javascript
+everyauth.justintv.configurable();
+```
+
## Setting up Vimeo OAuth
You will first need to sign up for a [developer application](http://vimeo.com/api/applications) to get the consumer key and secret.
@@ -1462,8 +1544,8 @@ Thanks to the following contributors for the following modules:
- [Torgeir](https://github.com/torgeir)
- DropBox
- [slickplaid](https://github.com/slickplaid)
- - Justin.tv
- - Vimeo
+ - Justin.tv
+ - Vimeo
### MIT License
Copyright (c) 2011 by Brian Noguchi
View
4 example/conf.js
@@ -35,6 +35,10 @@ module.exports = {
consumerKey: 'Alfrednerstu'
, consumerSecret: 'MXGftcxrRNMYn66CVmADR3KRnygCdYSk'
}
+ , justintv: {
+ consumerKey: 'enter your consumer key here'
+ , consumerSecret: 'enter your consumer secret here'
+ }
, dropbox: {
consumerKey: 'uhfqnbely5stdtm'
, consumerSecret: 'jr7ofuwo32l7vkd'
View
29 example/server.js
@@ -5,6 +5,7 @@ var express = require('express')
everyauth.debug = true;
var usersByVimeoId = {};
+var usersByJustintvId = {};
var usersByDropboxId = {};
var usersByFbId = {};
var usersByTwitId = {};
@@ -205,16 +206,24 @@ everyauth
})
.redirectPath('/')
-everyauth
- .vimeo
- .consumerKey(conf.vimeo.consumerKey)
- .consumerSecret(conf.vimeo.consumerSecret)
- .findOrCreateUser( function (sess, accessToken, accessSecret, vimeoUser) {
- return usersByVimeoId[vimeoUser.id] ||
- (usersByVimeoId[vimeoUser.id] = vimeoUser);
- })
- .redirectPath('/')
-
+everyauth.vimeo
+ .consumerKey(conf.vimeo.consumerKey)
+ .consumerSecret(conf.vimeo.consumerSecret)
+ .findOrCreateUser( function (sess, accessToken, accessSecret, vimeoUser) {
+ return usersByVimeoId[vimeoUser.id] ||
+ (usersByVimeoId[vimeoUser.id] = vimeoUser);
+ })
+ .redirectPath('/')
+
+everyauth.justintv
+ .consumerKey(conf.justintv.consumerKey)
+ .consumerSecret(conf.justintv.consumerSecret)
+ .findOrCreateUser( function (sess, accessToken, accessSecret, justintvUser) {
+ return usersByJustintvId[justintvUser.id] ||
+ (usersByJustintvId[justintvUser.id] = justintvUser);
+ })
+ .redirectPath('/')
+
everyauth.box
.apiKey(conf.box.apiKey)
.findOrCreateUser( function (sess, authToken, boxUser) {
View
9 example/views/home.jade
@@ -42,6 +42,9 @@
#vimeo-login
a(href='/auth/vimeo', style='border: 0px')
img(src='http://a.vimeocdn.com/images/logo_vimeo.png')
+ #justintv-login
+ a(href='/auth/justintv', style='border: 0px')
+ img(src='http://s.jtvnw.net/jtv_user_pictures/hosted_images/new_logo_148_40_black.png')
#box-login
a(href='/auth/box', style='border: 0px')
img(src='http://sites.box.net/apps/web/simpleshare/img/logo.png')
@@ -82,6 +85,12 @@
- if (everyauth.dropbox)
h3 Dropbox User Data
p= JSON.stringify(everyauth.dropbox.user)
+ - if (everyauth.justintv)
+ h3 Justin.tv User Data
+ p= JSON.stringify(everyauth.justintv.user)
+ - if (everyauth.vimeo)
+ h3 Vimeo User Data
+ p= JSON.stringify(everyauth.vimeo.user)
- if (everyauth.box)
h3 Box.net User Data
p= JSON.stringify(everyauth.box.user)
View
10 index.js
@@ -2,19 +2,18 @@ var connect = require('connect')
, __pause = connect.utils.pause
, everyauth = module.exports = {};
+// TODO Deprecate exposure of Promise
everyauth.Promise = require('./lib/promise');
everyauth.helpExpress = require('./lib/expressHelper');
everyauth.debug = false;
-// The connect middleware
-// e.g.,
+// The connect middleware. e.g.,
// connect(
-// connect.bodyParser()
-// , connect.cookieParser()
-// , connect.session({secret: 'oreo'})
+// ...
// , everyauth.middleware()
+// , ...
// )
everyauth.middleware = function () {
var app = connect(
@@ -64,6 +63,7 @@ everyauth._req = {
_methods: {}
, _getters: {}
};
+
everyauth.addRequestMethod = function (name, fn) {
this._req._methods[name] = fn;
return this;
View
10 lib/modules/justintv.js
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
var oauthModule = require('./oauth')
, OAuth = require('oauth').OAuth;
@@ -12,14 +13,23 @@ oauthModule.submodule('justintv')
, '1.0', null, 'HMAC-SHA1', null
);
})
+=======
+var oauthModule = require('./oauth');
+
+var justintv = module.exports =
+oauthModule.submodule('justintv')
+>>>>>>> master
.apiHost('http://api.justin.tv')
.oauthHost('http://api.justin.tv')
+<<<<<<< HEAD
.requestTokenPath('/oauth/request_token')
.authorizePath('/oauth/authorize')
.accessTokenPath('/oauth/access_token')
+=======
+>>>>>>> master
.entryPath('/auth/justintv')
.callbackPath('/auth/justintv/callback')
View
2  lib/modules/vimeo.js
@@ -1,4 +1,4 @@
-var oauthModule = require('./oauth')
+var oauthModule = require('./oauth');
var vimeo = module.exports =
oauthModule.submodule('vimeo')
View
3  package.json
@@ -1,13 +1,14 @@
{
"name": "everyauth",
"description": "Auth solution (password, facebook, & more) for your node.js Connect & Express apps",
- "version": "0.2.12",
+ "version": "0.2.13",
"homepage": "https://github.com/bnoguchi/everyauth/",
"repository": {
"type": "git",
"url": "git://github.com/bnoguchi/everyauth.git"
},
"author": "Brian Noguchi <brian.noguchi@gmail.com> (https://github.com/bnoguchi/)",
+ "keywords": ["auth", "oauth", "password", "facebook", "openid", "twitter", "authorization", "authentication", "connect", "express"],
"main": "./index.js",
"directories": {
"lib": "lib"
Please sign in to comment.
Something went wrong with that request. Please try again.