Skip to content

Commit 6285b5a

Browse files
committed
Merge branch 'develop'
2 parents e3dab0b + ff6e1e9 commit 6285b5a

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "oauth-js",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"main": "dist/oauth.min.js",
55
"description": "OAuth that just works",
66
"license": "apache2",

coffee/lib/oauth.coffee

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ module.exports = (window, document, jQuery, navigator) ->
114114
oauthio.request.mkHttp provider, tokens, request, method
115115

116116
make_res_endpoint = (method, url) ->
117-
oauthio.request.mkHttpEndpoint data.provider, tokens, request, method, url
117+
oauthio.request.mkHttpEndpoint provider, tokens, request, method, url
118118

119119
res = {}
120120
for i of tokens
@@ -124,9 +124,7 @@ module.exports = (window, document, jQuery, navigator) ->
124124
res.put = make_res("PUT")
125125
res.patch = make_res("PATCH")
126126
res.del = make_res("DELETE")
127-
res.me = (opts) ->
128-
oauthio.request.mkHttpMe data.provider, tokens, request, "GET"
129-
return
127+
res.me = oauthio.request.mkHttpMe provider, tokens, request, "GET"
130128

131129
res
132130

@@ -144,7 +142,10 @@ module.exports = (window, document, jQuery, navigator) ->
144142
opts = opts or {}
145143
unless config.key
146144
defer?.reject new Error("OAuth object must be initialized")
147-
return callback(new Error("OAuth object must be initialized"))
145+
if not callback?
146+
return
147+
else
148+
return callback(new Error("OAuth object must be initialized"))
148149
if arguments.length is 2 and typeof opts == 'function'
149150
callback = opts
150151
opts = {}
@@ -155,7 +156,7 @@ module.exports = (window, document, jQuery, navigator) ->
155156
if callback
156157
return callback(null, res)
157158
else
158-
return
159+
return defer.promise()
159160
unless opts.state
160161
opts.state = sha1.create_hash()
161162
opts.state_type = "client"

coffee/lib/oauthio_requests.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Url = require('../tools/url')()
22

3-
module.exports = ($, config, client_states, cache) ->
3+
module.exports = ($, config, client_states, cache, providers_api) ->
44
http: (opts) ->
55
doRequest = ->
66
request = options.oauthio.request or {}

dist/oauth.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
module.exports = {
33
oauthd_url: "https://oauth.io",
44
oauthd_api: "https://oauth.io/api",
5-
version: "web-0.2.0",
5+
version: "web-0.2.1",
66
options: {}
77
};
88

@@ -143,7 +143,7 @@ module.exports = function(window, document, jQuery, navigator) {
143143
return oauthio.request.mkHttp(provider, tokens, request, method);
144144
};
145145
make_res_endpoint = function(method, url) {
146-
return oauthio.request.mkHttpEndpoint(data.provider, tokens, request, method, url);
146+
return oauthio.request.mkHttpEndpoint(provider, tokens, request, method, url);
147147
};
148148
res = {};
149149
for (i in tokens) {
@@ -154,9 +154,7 @@ module.exports = function(window, document, jQuery, navigator) {
154154
res.put = make_res("PUT");
155155
res.patch = make_res("PATCH");
156156
res.del = make_res("DELETE");
157-
res.me = function(opts) {
158-
oauthio.request.mkHttpMe(data.provider, tokens, request, "GET");
159-
};
157+
res.me = oauthio.request.mkHttpMe(provider, tokens, request, "GET");
160158
return res;
161159
},
162160
popup: function(provider, opts, callback) {
@@ -180,7 +178,11 @@ module.exports = function(window, document, jQuery, navigator) {
180178
if (defer != null) {
181179
defer.reject(new Error("OAuth object must be initialized"));
182180
}
183-
return callback(new Error("OAuth object must be initialized"));
181+
if (callback == null) {
182+
return;
183+
} else {
184+
return callback(new Error("OAuth object must be initialized"));
185+
}
184186
}
185187
if (arguments.length === 2 && typeof opts === 'function') {
186188
callback = opts;
@@ -195,7 +197,7 @@ module.exports = function(window, document, jQuery, navigator) {
195197
if (callback) {
196198
return callback(null, res);
197199
} else {
198-
return;
200+
return defer.promise();
199201
}
200202
}
201203
}
@@ -448,7 +450,7 @@ var Url,
448450

449451
Url = require('../tools/url')();
450452

451-
module.exports = function($, config, client_states, cache) {
453+
module.exports = function($, config, client_states, cache, providers_api) {
452454
return {
453455
http: function(opts) {
454456
var defer, desc_opts, doRequest, i, options;

0 commit comments

Comments
 (0)