Skip to content

Commit b03bff7

Browse files
committed
Make refresh token request only if appKey and appSecret is present
1 parent aa3c0e1 commit b03bff7

File tree

5 files changed

+63
-59
lines changed

5 files changed

+63
-59
lines changed

build/ringcentral.js

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

build/ringcentral.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/ringcentral.min.js

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

build/ringcentral.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/platform/Platform.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,14 @@ Platform.prototype._refresh = function() {
392392
if (!this._auth.refreshToken()) throw new Error('Refresh token is missing');
393393
if (!this._auth.refreshTokenValid()) throw new Error('Refresh token has expired');
394394

395-
return this._tokenRequest(Platform._tokenEndpoint, {
396-
"grant_type": "refresh_token",
397-
"refresh_token": this._auth.refreshToken(),
398-
"access_token_ttl": this._auth.data().expires_in + 1,
399-
"refresh_token_ttl": this._auth.data().refresh_token_expires_in + 1
400-
});
395+
if (this.appKey && this.appSecret) {
396+
return this._tokenRequest(Platform._tokenEndpoint, {
397+
"grant_type": "refresh_token",
398+
"refresh_token": this._auth.refreshToken(),
399+
"access_token_ttl": this._auth.data().expires_in + 1,
400+
"refresh_token_ttl": this._auth.data().refresh_token_expires_in + 1
401+
});
402+
}
401403

402404
}.bind(this)).then(function(/** @type {ApiResponse} */ res) {
403405

0 commit comments

Comments
 (0)