Permalink
Browse files

make taobao login work

  • Loading branch information...
1 parent eea53fa commit b8d673382f3e753ac406741fdfdf39f31a1b40a7 @yyfrankyy yyfrankyy committed Sep 24, 2012
Showing with 9 additions and 14 deletions.
  1. +9 −14 lib/modules/taobao.js
View
@@ -6,7 +6,7 @@ oauthModule.submodule('taobao')
.configurable({
scope: 'specify types of access: item,, promotion, usergrade'
})
- .apiHost('https://eco.taobao.com/')
+ .apiHost('https://open.taobao.com/')
.oauthHost('https://oauth.taobao.com')
.authPath('/authorize')
@@ -23,21 +23,16 @@ oauthModule.submodule('taobao')
.entryPath('/auth/taobao')
.callbackPath('/auth/tb/callback')
- .fetchOAuthUser( function (accessToken) {
- var p = this.Promise();
- request.get({
- url: this.apiHost() + '/router/rest?method=taobao.user.get&v=2.0&fields=user_id,uid,nick,sex&access_token=' + accessToken
- }, function (err, res, data) {
- if (err) return p.fail(err);
- var oauthUser = JSON.parse(data);
- p.fulfill(oauthUser);
- });
- return p;
- p.fulfill(oauthUser);
- return p;
+ .fetchOAuthUser(function(accessToken, accessExtra, params) {
+ var extra = accessExtra.extra
+ return {
+ id: extra.taobao_user_id
+ , token: accessToken
+ , extra: extra
+ }
})
- .moduleErrback( function (err, seqValues) {
+ .moduleErrback(function(err, seqValues) {
if (err instanceof Error) {
var next = seqValues.next;
return next(err);

0 comments on commit b8d6733

Please sign in to comment.