WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit a300622

Browse files
committed
Merge branch 'Hotfix/state-verification'
2 parents 96949d5 + 44fa432 commit a300622

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
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.3",
3+
"version": "0.2.4",
44
"main": "dist/oauth.min.js",
55
"description": "OAuth that just works",
66
"license": "apache2",

coffee/lib/oauthio_requests.coffee

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,13 @@ module.exports = ($, config, client_states, cache, providers_api) ->
169169
return opts.callback(err)
170170
else
171171
return
172-
if not data.state or client_states.indexOf(data.state) is -1
172+
173+
#checking if state is known
174+
data.state = data.state.replace(/\s+/g,"")
175+
for k,v of client_states
176+
client_states[k] = v.replace(/\s+/g,"")
177+
178+
if not data.state or not client_states.indexOf(data.state) == -1
173179
defer?.reject new Error("State is not matching")
174180
if opts.callback and typeof opts.callback == "function"
175181
return opts.callback(new Error("State is not matching"))

dist/oauth.js

Lines changed: 8 additions & 3 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.3",
5+
version: "web-0.2.4",
66
options: {}
77
};
88

@@ -664,7 +664,7 @@ module.exports = function($, config, client_states, cache, providers_api) {
664664
};
665665
},
666666
sendCallback: function(opts, defer) {
667-
var base, data, e, err, i, make_res, request, res, tokens;
667+
var base, data, e, err, i, k, make_res, request, res, tokens, v;
668668
base = this;
669669
data = void 0;
670670
err = void 0;
@@ -715,7 +715,12 @@ module.exports = function($, config, client_states, cache, providers_api) {
715715
return;
716716
}
717717
}
718-
if (!data.state || client_states.indexOf(data.state) === -1) {
718+
data.state = data.state.replace(/\s+/g, "");
719+
for (k in client_states) {
720+
v = client_states[k];
721+
client_states[k] = v.replace(/\s+/g, "");
722+
}
723+
if (!data.state || !client_states.indexOf(data.state) === -1) {
719724
if (defer != null) {
720725
defer.reject(new Error("State is not matching"));
721726
}

0 commit comments

Comments
 (0)