Skip to content

Commit 796c627

Browse files
committed
Add support for oauth client secret when calling the token URL. Fixes swagger-api#1384. Fixes swagger-api#1324.
1 parent d75505f commit 796c627

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/swagger-oauth.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var clientId;
55
var realm;
66
var oauth2KeyName;
77
var redirect_uri;
8+
var clientSecret;
89

910
function handleLogin() {
1011
var scopes = [];
@@ -184,6 +185,7 @@ function initOAuth(opts) {
184185
popupMask = (o.popupMask||$('#api-common-mask'));
185186
popupDialog = (o.popupDialog||$('.api-popup-dialog'));
186187
clientId = (o.clientId||errors.push('missing client id'));
188+
clientSecret = (o.clientSecret||errors.push('missing client secret'));
187189
realm = (o.realm||errors.push('missing realm'));
188190

189191
if(errors.length > 0){
@@ -206,6 +208,7 @@ function initOAuth(opts) {
206208
window.processOAuthCode = function processOAuthCode(data) {
207209
var params = {
208210
'client_id': clientId,
211+
'client_secret': clientSecret,
209212
'code': data.code,
210213
'grant_type': 'authorization_code',
211214
'redirect_uri': redirect_uri

src/main/html/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
if(typeof initOAuth == "function") {
3838
initOAuth({
3939
clientId: "your-client-id",
40+
clientSecret: "your-client-secret",
4041
realm: "your-realms",
4142
appName: "your-app-name"
4243
});

0 commit comments

Comments
 (0)