Merge pull request #1648 from estiller/master

Support additional query parameters during OAuth2 authorization process
This commit is contained in:
Tony Tam
2015-12-09 14:36:38 -08:00
4 changed files with 14 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ var oauth2KeyName;
var redirect_uri;
var clientSecret;
var scopeSeparator;
var additionalQueryStringParams;
function handleLogin() {
var scopes = [];
@@ -156,6 +157,9 @@ function handleLogin() {
url += '&client_id=' + encodeURIComponent(clientId);
url += '&scope=' + encodeURIComponent(scopes.join(scopeSeparator));
url += '&state=' + encodeURIComponent(state);
for (var key in additionalQueryStringParams) {
url += '&' + key + '=' + encodeURIComponent(additionalQueryStringParams[key]);
}
window.open(url);
});
@@ -190,6 +194,7 @@ function initOAuth(opts) {
clientSecret = (o.clientSecret||null);
realm = (o.realm||errors.push('missing realm'));
scopeSeparator = (o.scopeSeparator||' ');
additionalQueryStringParams = (o.additionalQueryStringParams||{});
if(errors.length > 0){
log('auth unable initialize oauth: ' + errors);