Skip to content

Commit e35acfe

Browse files
author
André Coelho
committed
Fix charAt and substr of undefined
1 parent a7ea4a4 commit e35acfe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/providers/oauth-token-provider.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,14 @@ function OAuthTokenProvider() {
7373
*/
7474

7575
getAuthorizationHeader() {
76-
if (!(this.getTokenType() && this.getAccessToken())) {
76+
const tokenType = this.getTokenType();
77+
const accessToken = this.getAccessToken();
78+
79+
if (!tokenType || !accessToken) {
7780
return;
7881
}
7982

80-
return `${this.getTokenType().charAt(0).toUpperCase() + this.getTokenType().substr(1)} ${this.getAccessToken()}`;
83+
return `${tokenType.charAt(0).toUpperCase() + tokenType.substr(1)} ${accessToken}`;
8184
}
8285

8386
/**

0 commit comments

Comments
 (0)