Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with question mark param in callback url #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion oauth-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ var OAuthService = (function () {
var _this = this;
options = options || {};
var parts = this.getFragment();
if(parts === false){
return false;
}
var accessToken = parts["access_token"];
var idToken = parts["id_token"];
var state = parts["state"];
Expand Down Expand Up @@ -280,7 +283,14 @@ var OAuthService = (function () {
;
OAuthService.prototype.getFragment = function () {
if (window.location.hash.indexOf("#") === 0) {
return this.parseQueryString(window.location.hash.substr(1));
if(this.redirectUri.indexOf('#')) {
var returnUrlHashPart = this.redirectUri.split('#');
var currentHashPart = window.location.hash.substr(1);
if(currentHashPart.indexOf(returnUrlHashPart[1]) === 0) {
return this.parseQueryString(window.location.hash.substr(1));
}
}
return false;
}
else {
return {};
Expand All @@ -293,6 +303,10 @@ var OAuthService = (function () {
return data;
}
pairs = queryString.split("&");
if(pairs.length && pairs[0].indexOf("?")){
var firstPart = pairs[0].split("?");
pairs[0] = firstPart[1];
}
for (var i = 0; i < pairs.length; i++) {
pair = pairs[i];
separatorIndex = pair.indexOf("=");
Expand Down