Skip to content

Commit

Permalink
fix: verifyIdToken will never return null (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed Oct 15, 2018
1 parent f65375b commit b4ea57f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/auth/oauth2client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -829,14 +829,14 @@ export class OAuth2Client extends AuthClient {
* @param options that contains all options.
* @param callback Callback supplying GoogleLogin if successful
*/
verifyIdToken(options: VerifyIdTokenOptions): Promise<LoginTicket|null>;
verifyIdToken(options: VerifyIdTokenOptions): Promise<LoginTicket>;
verifyIdToken(
options: VerifyIdTokenOptions,
callback: (err: Error|null, login?: LoginTicket|null) => void): void;
callback: (err: Error|null, login?: LoginTicket) => void): void;
verifyIdToken(
options: VerifyIdTokenOptions,
callback?: (err: Error|null, login?: LoginTicket|null) => void):
void|Promise<LoginTicket|null> {
callback?: (err: Error|null, login?: LoginTicket) => void):
void|Promise<LoginTicket> {
// This function used to accept two arguments instead of an options object.
// Check the types to help users upgrade with less pain.
// This check can be removed after a 2.0 release.
Expand All @@ -853,7 +853,7 @@ export class OAuth2Client extends AuthClient {
}

private async verifyIdTokenAsync(options: VerifyIdTokenOptions):
Promise<LoginTicket|null> {
Promise<LoginTicket> {
if (!options.idToken) {
throw new Error('The verifyIdToken method requires an ID Token');
}
Expand Down

0 comments on commit b4ea57f

Please sign in to comment.