Skip to content

Commit

Permalink
Add support for oauth client secret when calling the token URL. Fixes s…
Browse files Browse the repository at this point in the history
  • Loading branch information
lucian303 committed Jun 25, 2015
1 parent d75505f commit 796c627
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/swagger-oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var clientId;
var realm;
var oauth2KeyName;
var redirect_uri;
var clientSecret;

function handleLogin() {
var scopes = [];
Expand Down Expand Up @@ -184,6 +185,7 @@ function initOAuth(opts) {
popupMask = (o.popupMask||$('#api-common-mask'));
popupDialog = (o.popupDialog||$('.api-popup-dialog'));
clientId = (o.clientId||errors.push('missing client id'));
clientSecret = (o.clientSecret||errors.push('missing client secret'));
realm = (o.realm||errors.push('missing realm'));

if(errors.length > 0){
Expand All @@ -206,6 +208,7 @@ function initOAuth(opts) {
window.processOAuthCode = function processOAuthCode(data) {
var params = {
'client_id': clientId,
'client_secret': clientSecret,
'code': data.code,
'grant_type': 'authorization_code',
'redirect_uri': redirect_uri
Expand Down
1 change: 1 addition & 0 deletions src/main/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
if(typeof initOAuth == "function") {
initOAuth({
clientId: "your-client-id",
clientSecret: "your-client-secret",
realm: "your-realms",
appName: "your-app-name"
});
Expand Down

0 comments on commit 796c627

Please sign in to comment.