Skip to content

Commit

Permalink
fix: populate credentials.refresh_token if provided (#881)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Jan 28, 2020
1 parent c74c470 commit 63c4637
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/auth/refreshclient.ts
Expand Up @@ -67,6 +67,7 @@ export class UserRefreshClient extends OAuth2Client {
forceRefreshOnFailure: opts.forceRefreshOnFailure,
});
this._refreshToken = opts.refreshToken;
this.credentials.refresh_token = opts.refreshToken;
}

/**
Expand Down
7 changes: 7 additions & 0 deletions test/test.refresh.ts
Expand Up @@ -28,6 +28,13 @@ function createJSON() {
};
}

it('populates credentials.refresh_token if provided', () => {
const refresh = new UserRefreshClient({
refreshToken: 'abc123',
});
assert.strictEqual(refresh.credentials.refresh_token, 'abc123');
});

it('fromJSON should error on null json', () => {
const refresh = new UserRefreshClient();
assert.throws(() => {
Expand Down

0 comments on commit 63c4637

Please sign in to comment.