Skip to content

Commit

Permalink
Fix charAt and substr of undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
André Coelho committed Apr 3, 2017
1 parent a7ea4a4 commit e35acfe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/providers/oauth-token-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,14 @@ function OAuthTokenProvider() {
*/

getAuthorizationHeader() {
if (!(this.getTokenType() && this.getAccessToken())) {
const tokenType = this.getTokenType();
const accessToken = this.getAccessToken();

if (!tokenType || !accessToken) {
return;
}

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

/**
Expand Down

0 comments on commit e35acfe

Please sign in to comment.