Skip to content

Commit ae7d562

Browse files
committed
Update getRefreshToken to allow data and options override
1 parent cef07df commit ae7d562

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/providers/oauth-provider.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,28 +142,30 @@ function OAuthProvider() {
142142
* Retrieves the `refresh_token` and stores the `response.data` on cookies
143143
* using the `OAuthToken`.
144144
*
145+
* @param {object} data - Request content.
146+
* @param {object} options - Optional configuration.
145147
* @return {promise} A response promise.
146148
*/
147149

148-
getRefreshToken() {
149-
var data = {
150+
getRefreshToken(data, options) {
151+
data = angular.extend({
150152
client_id: config.clientId,
151153
grant_type: 'refresh_token',
152154
refresh_token: OAuthToken.getRefreshToken(),
153-
};
155+
}, data);
154156

155157
if (null !== config.clientSecret) {
156158
data.client_secret = config.clientSecret;
157159
}
158160

159161
data = queryString.stringify(data);
160162

161-
var options = {
163+
options = angular.extend({
162164
headers: {
163165
'Authorization': undefined,
164166
'Content-Type': 'application/x-www-form-urlencoded'
165167
}
166-
};
168+
}, options);
167169

168170
return $http.post(`${config.baseUrl}${config.grantPath}`, data, options).then((response) => {
169171
OAuthToken.setToken(response.data);

0 commit comments

Comments
 (0)