Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

include smarterer oauth #281

Merged
merged 5 commits into from

2 participants

@kaizenpack

No description provided.

@bnoguchi
Owner

Can you add smarterer to the README? Thanks!

@kaizenpack

Thanks for the reminder - these should be ready now.

@bnoguchi
Owner

Thanks! Merging now.

@bnoguchi bnoguchi merged commit 784547f into bnoguchi:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 24, 2012
  1. @kaizenpack

    added smarterer oauth

    kaizenpack authored
Commits on Jun 12, 2012
  1. @kaizenpack
Commits on Jun 13, 2012
  1. @kaizenpack

    added smarterer to README

    kaizenpack authored
  2. @kaizenpack

    added full detail section

    kaizenpack authored
  3. @kaizenpack

    fixed indentation issue

    kaizenpack authored
This page is out of date. Refresh to see the latest.
View
36 README.md
@@ -52,6 +52,8 @@ So far, `everyauth` enables you to login via:
<td> <a href="http://github.com/wnadeau">Winfred Nadeau</a>
<tr> <td> <img src="https://github.com/bnoguchi/everyauth/raw/master/media/mendeley.ico" style="vertical-align:middle"> Mendeley
<td> <a href="https://github.com/edy-b">Eduard Baun</a>
+ <tr> <td> <img src="https://github.com/bnoguchi/everyauth/raw/master/media/smarterer.ico" style="vertical-align:middle"> Smarterer
+ <td> <a href="https://github.com/kaizenpack">kaizenpack</a>
</tbody>
<tbody id=misc>
<tr> <td> <img src="https://github.com/bnoguchi/everyauth/raw/master/media/box.ico" style="vertical-align:middle"> Box.net <td>
@@ -2195,6 +2197,40 @@ connect(
).listen(3000);
```
+### Smarterer
+
+You will need to register for an app id [here](http://www.smarterer.com/). Implementation details follow the same pattern as with other
+oauth2 implementations.
+
+```javascript
+
+var everyauth = require('everyauth')
+ , connect = require('connect');
+
+everyauth.smarterer
+ .appId('YOUR APP ID')
+ .appSecret('YOUR APP SECRET')
+ .findOrCreateUser(function(session, accessToken, accessTokenSecret, userData) {
+ // find or create user logic goes here
+ // userData.userName will contain the smarterer username for the authenticated user
+ // userData.badges will contain the scores on quizes
+ })
+ .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);
+```
+
+
### Box.net
```javascript
View
30 lib/modules/smarterer.js
@@ -0,0 +1,30 @@
+var oauthModule = require('./oauth2')
+ , querystring= require('querystring');
+
+var smarterer = module.exports =
+oauthModule.submodule('smarterer')
+ .oauthHost('https://smarterer.com')
+ .apiHost('https://smarterer.com')
+
+ .entryPath('/auth/smarterer')
+ .callbackPath('/auth/smarterer/callback')
+
+ .authQueryParam('callback_url', function() {
+ return this._myHostname + this._callbackPath;
+ })
+
+ .accessTokenParam('grant_type', 'authorization_code')
+
+
+ .fetchOAuthUser( function (accessToken) {
+ var p = this.Promise();
+ this.oauth.get(this.apiHost() + '/api/badges', accessToken, function (err, data) {
+ if (err) return p.fail(err.error_message);
+ var oauthUser = JSON.parse(data);
+ p.fulfill(oauthUser);
+ })
+ return p;
+ })
+ .convertErr( function (data) {
+ return new Error(data.error_message);
+ });
View
BIN  media/smarterer.ico
Binary file not shown
Something went wrong with that request. Please try again.