Skip to content
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
10 changes: 6 additions & 4 deletions rest-api-sdk/src/api/OAuthApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(function(factory) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../utils/ApiClient'), require('../utils/Context'), require('../utils/OAuthUtils'), require('../model/oAuth/OAuthIndex'), require('../utils/validator/OAuthApiValidator'), require('../utils/ApiError'));

}(function(ApiClient, Context, OAuthUtils, OAuthIndex, OAuthApiValidator, ApiError) {
'use strict';

Expand All @@ -35,7 +35,7 @@
/**
* Retrieves the authorization url that will be used to get the authorization code.
* @function getAuthorizationUrl
* @param authorizationRequest {Object} Authorization request
* @param authorizationRequest {Object} Authorization request
* @returns {String} The authorization url where the user will be directed to authorize the application.
* @instance
*/
Expand Down Expand Up @@ -64,7 +64,7 @@
/**
* Retrieves the access token with the required scopes using the authorization code granted during the authorization.
* @function getAccessToken
* @param accessTokenRequest {Object} Access token request
* @param accessTokenRequest {Object} Access token request
* @returns {Promise} A promise that returns {@link module:model/oAuth/AccessTokenResponse|AccessTokenResponse} if resolved and apiError if rejected.
* @instance
*/
Expand Down Expand Up @@ -141,7 +141,9 @@
'refresh_token': accessTokenRefreshRequest['refreshToken'],
'client_id': accessTokenRefreshRequest['clientId'],
'client_secret': accessTokenRefreshRequest['clientSecret'],
'grant_type': accessTokenRefreshRequest['grantType']
'grant_type': accessTokenRefreshRequest['grantType'],
'redirect_uri': accessTokenRefreshRequest['redirectUri'],
'code': accessTokenRefreshRequest['code']
};

var contentTypes = ['application/x-www-form-urlencoded'];
Expand Down
49 changes: 47 additions & 2 deletions rest-api-sdk/src/model/oAuth/AccessTokenRefreshRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
(function(factory) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../../utils/ApiClient'));

}(function(ApiClient) {
'use strict';

Expand All @@ -38,11 +38,13 @@ var AccessTokenRefreshRequest = function() {
_this.clientSecret = undefined;
_this.refreshToken = undefined;
_this.grantType = undefined;
_this.code = undefined;
_this.redirectUri = undefined;

/**
* Identifies the application configured on the OAuth Configuration page.
* @function getClientId
* @return clientId {string}
* @return clientId {string}
* @instance
*/
_this.getClientId = function() {
Expand Down Expand Up @@ -119,6 +121,41 @@ var AccessTokenRefreshRequest = function() {
this.grantType = grantType;
};

/**
* The url where the end user will be redirected after successful completion of authorization.
* This value must belong to the set of values specified on the OAuth Configuration page.
* @function getRedirectUri
* @return redirectUri {string}
* @instance
*/
_this.getRedirectUri = function() {
return this.redirectUri;
};

/**
* The url where the end user will be redirected after successful completion of authorization.
* This value must belong to the set of values specified on the OAuth Configuration page.
* @function setRedirectUri
* @param redirectUri {string} RedirectUri
* @instance
*/
_this.setRedirectUri = function (redirectUri) {
this.redirectUri = redirectUri;
};

/**
* @return code
*/
_this.getCode = function() {
return this.code;
};

/**
* @param code Code
*/
_this.setCode = function (code) {
this.code = code;
};
};


Expand Down Expand Up @@ -146,6 +183,14 @@ AccessTokenRefreshRequest.constructFromObject = function(data, obj) {
if (data.hasOwnProperty('grant_type')) {
obj.setGrantType(data.grant_type);
}

if (data.hasOwnProperty('redirect_uri')) {
obj.setRedirectUri(data.redirect_uri);
}

if (data.hasOwnProperty('code')) {
obj.setCode(data.code);
}
}
return obj;
};
Expand Down