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

Adding skipRedirect config option to prevent changing the URL hash #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Here are more options to JSO:
* `scope`: For providers that does not support `state`: If state was not provided, and default provider contains a scope parameter we assume this is the one requested... Set this as the same list of scopes that you provide to `ensure_tokens`.
* `scopes.request`: Control what scopes are requested in the authorization request.
* `debug`: If debug is set to true, verbose logging will make it easier to debug problems with JSO.
* `skipRedirect`: If skipRedirect is set to true, JSO will not change the hash after handling an access token.


## Catching the response when the user is returning
Expand Down
8 changes: 3 additions & 5 deletions build/jso.js
Original file line number Diff line number Diff line change
Expand Up @@ -1056,10 +1056,8 @@ define('jso',['require','exports','module','./store','./utils','./Config'],funct

store.saveToken(state.providerID, atoken);

if (state.restoreHash) {
window.location.hash = state.restoreHash;
} else {
window.location.hash = '';
if (!this.config.get('skipRedirect', null)) {
window.location.hash = state.restoreHash || '';
}


Expand All @@ -1077,7 +1075,7 @@ define('jso',['require','exports','module','./store','./utils','./Config'],funct
utils.log("Successfully obtain a token, now call the callback, and may be the window closes", callback);

if (typeof callback === 'function') {
callback(atoken);
callback(atoken, state.restoreHash || '');
}

// utils.log(atoken);
Expand Down
8 changes: 3 additions & 5 deletions src/jso.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,8 @@ define(function(require, exports, module) {

store.saveToken(state.providerID, atoken);

if (state.restoreHash) {
window.location.hash = state.restoreHash;
} else {
window.location.hash = '';
if (!this.config.get('skipRedirect', null)) {
window.location.hash = state.restoreHash || '';
}


Expand All @@ -275,7 +273,7 @@ define(function(require, exports, module) {
utils.log("Successfully obtain a token, now call the callback, and may be the window closes", callback);

if (typeof callback === 'function') {
callback(atoken);
callback(atoken, state.restoreHash || '');
}

// utils.log(atoken);
Expand Down