Skip to content

Commit 8ccce81

Browse files
committed
update samples and build
1 parent 69307b4 commit 8ccce81

4 files changed

Lines changed: 26 additions & 24 deletions

File tree

‎dist/oidc-client.js‎

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎sample/oidc.js‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ module.exports = function(baseUrl, app) {
131131
var response_type = req.query.response_type;
132132

133133
var url = req.query.redirect_uri;
134+
135+
var state = req.query.state;
136+
if (state) {
137+
url = addFragment(url, "state", state);
138+
}
139+
140+
//url = addFragment(url, "error", "bad_stuff"); res.redirect(url); return;
134141

135142
if (isOAuth(response_type)) {
136143
var access_token = genAccessToken();
@@ -145,11 +152,6 @@ module.exports = function(baseUrl, app) {
145152
url = addFragment(url, "session_state", "123");
146153
}
147154

148-
var state = req.query.state;
149-
if (state) {
150-
url = addFragment(url, "state", state);
151-
}
152-
153155
res.redirect(url);
154156
});
155157

‎sample/public/oidc-client-sample.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function signin() {
3838
if (followLinks()) {
3939
window.location = req.url;
4040
}
41-
}, function(err) {
41+
}).catch(function(err) {
4242
log(err);
4343
});
4444
}
@@ -48,8 +48,8 @@ function processSigninResponse() {
4848
client.processSigninResponse().then(function(response) {
4949
signinResponse = response;
5050
log("signin response", signinResponse);
51-
}, function(err) {
52-
log(err.message);
51+
}).catch(function(err) {
52+
log(err);
5353
});
5454
}
5555

@@ -66,8 +66,8 @@ function processSignoutResponse() {
6666
client.processSignoutResponse().then(function(response) {
6767
signinResponse = null;
6868
log("signout response", response);
69-
}, function(err) {
70-
log(err.message);
69+
}).catch(function(err) {
70+
log(err);
7171
});
7272
}
7373

‎sample/public/user-manager-sample.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,71 +66,71 @@ mgr.events.addSilentRenewError(function (e) {
6666
function clearState(){
6767
mgr.clearStaleState().then(function(){
6868
log("clearStateState success");
69-
}, function(e){
69+
}).catch(function(e){
7070
log("clearStateState error", e.message);
7171
});
7272
}
7373

7474
function getUser() {
7575
mgr.getUser().then(function(user) {
7676
log("got user", user);
77-
}, function(err) {
77+
}).catch(function(err) {
7878
log(err);
7979
});
8080
}
8181

8282
function removeUser() {
8383
mgr.removeUser().then(function() {
8484
log("user removed");
85-
}, function(err) {
85+
}).catch(function(err) {
8686
log(err);
8787
});
8888
}
8989

9090
function startSigninMainWindow() {
9191
mgr.signinRedirect({data:'some data'}).then(function() {
9292
log("signinRedirect done");
93-
}, function(err) {
93+
}).catch(function(err) {
9494
log(err);
9595
});
9696
}
9797

9898
function endSigninMainWindow() {
9999
mgr.signinRedirectCallback().then(function(user) {
100100
log("signed in", user);
101-
}, function(err) {
101+
}).catch(function(err) {
102102
log(err);
103103
});
104104
}
105105

106106
function popupSignin() {
107107
mgr.signinPopup({data:'some data'}).then(function(user) {
108108
log("signed in", user);
109-
}, function(err) {
109+
}).catch(function(err) {
110110
log(err);
111111
});
112112
}
113113

114114
function iframeSignin() {
115115
mgr.signinSilent({data:'some data'}).then(function(user) {
116116
log("signed in", user);
117-
}, function(err) {
117+
}).catch(function(err) {
118118
log(err);
119119
});
120120
}
121121

122122
function startSignoutMainWindow(){
123123
mgr.signoutRedirect({data:'some data'}).then(function(resp) {
124124
log("signed out", resp);
125-
}, function(err) {
125+
}).catch(function(err) {
126126
log(err);
127127
});
128128
};
129129

130130
function endSignoutMainWindow(){
131131
mgr.signoutRedirectCallback().then(function(resp) {
132132
log("signed out", resp);
133-
}, function(err) {
133+
}).catch(function(err) {
134134
log(err);
135135
});
136136
};

0 commit comments

Comments
 (0)