{"action":"created","comment":{"url":"https://api.github.com/repos/google/google-auth-library-nodejs/pulls/comments/113031490","pull_request_review_id":34384515,"id":113031490,"diff_hunk":"@@ -0,0 +1,586 @@\n+/**\n+ * Copyright 2014 Google Inc. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+import AuthClient from './authclient';\n+import LoginTicket from './loginticket';\n+import PemVerifier from './../pemverifier';\n+import { merge } from 'lodash';\n+import * as querystring from 'querystring';\n+import * as util from 'util';\n+const noop = Function.prototype;\n+\n+export default class OAuth2Client extends AuthClient {\n+\n+  public _clientId: string;\n+  public _clientSecret: string;\n+  public apiKey: string;\n+\n+  private _redirectUri: string;\n+  private _certificateCache = null;\n+  private _certificateExpiry = null;\n+  protected _opts: any;\n+\n+  /**\n+   * Handles OAuth2 flow for Google APIs.\n+   *\n+   * @param {string} clientId The authentication client ID.\n+   * @param {string} clientSecret The authentication client secret.\n+   * @param {string} redirectUri The URI to redirect to after completing the auth request.\n+   * @param {Object} opt_opts optional options for overriding the given parameters.\n+   * @constructor\n+   */\n+  constructor(clientId?: string, clientSecret?: string, redirectUri?: string, opt_opts?: any) {\n+    super();\n+    this._clientId = clientId;\n+    this._clientSecret = clientSecret;\n+    this._redirectUri = redirectUri;\n+    this._opts = opt_opts || {};\n+    this.credentials = {};\n+  }\n+\n+  /**\n+   * The base URL for auth endpoints.\n+   */\n+  private readonly GOOGLE_OAUTH2_AUTH_BASE_URL_ = 'https://accounts.google.com/o/oauth2/auth';","path":"lib/auth/oauth2client.ts","position":57,"original_position":57,"commit_id":"e5fdec19199d2d2e7d68086d3f252cecf6cd6a76","original_commit_id":"e5fdec19199d2d2e7d68086d3f252cecf6cd6a76","user":{"login":"matthewloring","id":1485909,"avatar_url":"https://avatars0.githubusercontent.com/u/1485909?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewloring","html_url":"https://github.com/matthewloring","followers_url":"https://api.github.com/users/matthewloring/followers","following_url":"https://api.github.com/users/matthewloring/following{/other_user}","gists_url":"https://api.github.com/users/matthewloring/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewloring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewloring/subscriptions","organizations_url":"https://api.github.com/users/matthewloring/orgs","repos_url":"https://api.github.com/users/matthewloring/repos","events_url":"https://api.github.com/users/matthewloring/events{/privacy}","received_events_url":"https://api.github.com/users/matthewloring/received_events","type":"User","site_admin":false},"body":"Should these be static?","created_at":"2017-04-24T19:09:49Z","updated_at":"2017-04-24T19:18:08Z","html_url":"https://github.com/google/google-auth-library-nodejs/pull/135#discussion_r113031490","pull_request_url":"https://api.github.com/repos/google/google-auth-library-nodejs/pulls/135","_links":{"self":{"href":"https://api.github.com/repos/google/google-auth-library-nodejs/pulls/comments/113031490"},"html":{"href":"https://github.com/google/google-auth-library-nodejs/pull/135#discussion_r113031490"},"pull_request":{"href":"https://api.github.com/repos/google/google-auth-library-nodejs/pulls/135"}}},"pull_request":{"url":"https://api.github.com/repos/google/google-auth-library-nodejs/pulls/135","id":116854978,"html_url":"https://github.com/google/google-auth-library-nodejs/pull/135","diff_url":"https://github.com/google/google-auth-library-nodejs/pull/135.diff","patch_url":"https://github.com/google/google-auth-library-nodejs/pull/135.patch","issue_url":"https://api.github.com/repos/google/google-auth-library-nodejs/issues/135","number":135,"state":"open","locked":false,"title":"Switch to TypeScript","user":{"login":"JustinBeckwith","id":534619,"avatar_url":"https://avatars1.githubusercontent.com/u/534619?v=3","gravatar_id":"","url":"https://api.github.com/users/JustinBeckwith","html_url":"https://github.com/JustinBeckwith","followers_url":"https://api.github.com/users/JustinBeckwith/followers","following_url":"https://api.github.com/users/JustinBeckwith/following{/other_user}","gists_url":"https://api.github.com/users/JustinBeckwith/gists{/gist_id}","starred_url":"https://api.github.com/users/JustinBeckwith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JustinBeckwith/subscriptions","organizations_url":"https://api.github.com/users/JustinBeckwith/orgs","repos_url":"https://api.github.com/users/JustinBeckwith/repos","events_url":"https://api.github.com/users/JustinBeckwith/events{/privacy}","received_events_url":"https://api.github.com/users/JustinBeckwith/received_events","type":"User","site_admin":false},"body":"This is an initial cut of a TypeScript conversion.  It compiles, and the linter passes.  Tests passing, switched to tsdoc, tslint, added VSCode stuff, all the things. ","created_at":"2017-04-20T20:15:13Z","updated_at":"2017-04-24T19:18:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"50b9cd691b853a00c7552c63b2952e99ae9e5045","assignee":{"login":"JustinBeckwith","id":534619,"avatar_url":"https://avatars1.githubusercontent.com/u/534619?v=3","gravatar_id":"","url":"https://api.github.com/users/JustinBeckwith","html_url":"https://github.com/JustinBeckwith","followers_url":"https://api.github.com/users/JustinBeckwith/followers","following_url":"https://api.github.com/users/JustinBeckwith/following{/other_user}","gists_url":"https://api.github.com/users/JustinBeckwith/gists{/gist_id}","starred_url":"https://api.github.com/users/JustinBeckwith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JustinBeckwith/subscriptions","organizations_url":"https://api.github.com/users/JustinBeckwith/orgs","repos_url":"https://api.github.com/users/JustinBeckwith/repos","events_url":"https://api.github.com/users/JustinBeckwith/events{/privacy}","received_events_url":"https://api.github.com/users/JustinBeckwith/received_events","type":"User","site_admin":false},"assignees":[{"login":"JustinBeckwith","id":534619,"avatar_url":"https://avatars1.githubusercontent.com/u/534619?v=3","gravatar_id":"","url":"https://api.github.com/users/JustinBeckwith","html_url":"https://github.com/JustinBeckwith","followers_url":"https://api.github.com/users/JustinBeckwith/followers","following_url":"https://api.github.com/users/JustinBeckwith/following{/other_user}","gists_url":"https://api.github.com/users/JustinBeckwith/gists{/gist_id}","starred_url":"https://api.github.com/users/JustinBeckwith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JustinBeckwith/subscriptions","organizations_url":"https://api.github.com/users/JustinBeckwith/orgs","repos_url":"https://api.github.com/users/JustinBeckwith/repos","events_url":"https://api.github.com/users/JustinBeckwith/events{/privacy}","received_events_url":"https://api.github.com/users/JustinBeckwith/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/google/google-auth-library-nodejs/pulls/135/commits","review_comments_url":"https://api.github.com/repos/google/google-auth-library-nodejs/pulls/135/comments","review_comment_url":"https://api.github.com/repos/google/google-auth-library-nodejs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/google-auth-library-nodejs/issues/135/comments","statuses_url":"https://api.github.com/repos/google/google-auth-library-nodejs/statuses/e5fdec19199d2d2e7d68086d3f252cecf6cd6a76","head":{"label":"JustinBeckwith:master","ref":"master","sha":"e5fdec19199d2d2e7d68086d3f252cecf6cd6a76","user":{"login":"JustinBeckwith","id":534619,"avatar_url":"https://avatars1.githubusercontent.com/u/534619?v=3","gravatar_id":"","url":"https://api.github.com/users/JustinBeckwith","html_url":"https://github.com/JustinBeckwith","followers_url":"https://api.github.com/users/JustinBeckwith/followers","following_url":"https://api.github.com/users/JustinBeckwith/following{/other_user}","gists_url":"https://api.github.com/users/JustinBeckwith/gists{/gist_id}","starred_url":"https://api.github.com/users/JustinBeckwith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JustinBeckwith/subscriptions","organizations_url":"https://api.github.com/users/JustinBeckwith/orgs","repos_url":"https://api.github.com/users/JustinBeckwith/repos","events_url":"https://api.github.com/users/JustinBeckwith/events{/privacy}","received_events_url":"https://api.github.com/users/JustinBeckwith/received_events","type":"User","site_admin":false},"repo":{"id":88762509,"name":"google-auth-library-nodejs","full_name":"JustinBeckwith/google-auth-library-nodejs","owner":{"login":"JustinBeckwith","id":534619,"avatar_url":"https://avatars1.githubusercontent.com/u/534619?v=3","gravatar_id":"","url":"https://api.github.com/users/JustinBeckwith","html_url":"https://github.com/JustinBeckwith","followers_url":"https://api.github.com/users/JustinBeckwith/followers","following_url":"https://api.github.com/users/JustinBeckwith/following{/other_user}","gists_url":"https://api.github.com/users/JustinBeckwith/gists{/gist_id}","starred_url":"https://api.github.com/users/JustinBeckwith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JustinBeckwith/subscriptions","organizations_url":"https://api.github.com/users/JustinBeckwith/orgs","repos_url":"https://api.github.com/users/JustinBeckwith/repos","events_url":"https://api.github.com/users/JustinBeckwith/events{/privacy}","received_events_url":"https://api.github.com/users/JustinBeckwith/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JustinBeckwith/google-auth-library-nodejs","description":"Google Auth Library for Node.js","fork":true,"url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs","forks_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/forks","keys_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/teams","hooks_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/hooks","issue_events_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/issues/events{/number}","events_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/events","assignees_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/assignees{/user}","branches_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/branches{/branch}","tags_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/tags","blobs_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/git/refs{/sha}","trees_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/statuses/{sha}","languages_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/languages","stargazers_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/stargazers","contributors_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/contributors","subscribers_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/subscribers","subscription_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/subscription","commits_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/commits{/sha}","git_commits_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/git/commits{/sha}","comments_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/comments{/number}","issue_comment_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/issues/comments{/number}","contents_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/contents/{+path}","compare_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/merges","archive_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/downloads","issues_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/issues{/number}","pulls_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/pulls{/number}","milestones_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/milestones{/number}","notifications_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/labels{/name}","releases_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/releases{/id}","deployments_url":"https://api.github.com/repos/JustinBeckwith/google-auth-library-nodejs/deployments","created_at":"2017-04-19T15:44:36Z","updated_at":"2017-04-20T20:14:51Z","pushed_at":"2017-04-22T23:09:31Z","git_url":"git://github.com/JustinBeckwith/google-auth-library-nodejs.git","ssh_url":"git@github.com:JustinBeckwith/google-auth-library-nodejs.git","clone_url":"https://github.com/JustinBeckwith/google-auth-library-nodejs.git","svn_url":"https://github.com/JustinBeckwith/google-auth-library-nodejs","homepage":"","size":423,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"d38f6c5c276851b8f36f3da240d070bf7d598ec6","user":{"login":"google","id":1342004,"avatar_url":"https://avatars2.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":30676220,"name":"google-auth-library-nodejs","full_name":"google/google-auth-library-nodejs","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars2.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/google-auth-library-nodejs","description":"Google Auth Library for Node.js","fork":false,"url":"https://api.github.com/repos/google/google-auth-library-nodejs","forks_url":"https://api.github.com/repos/google/google-auth-library-nodejs/forks","keys_url":"https://api.github.com/repos/google/google-auth-library-nodejs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/google-auth-library-nodejs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/google-auth-library-nodejs/teams","hooks_url":"https://api.github.com/repos/google/google-auth-library-nodejs/hooks","issue_events_url":"https://api.github.com/repos/google/google-auth-library-nodejs/issues/events{/number}","events_url":"https://api.github.com/repos/google/google-auth-library-nodejs/events","assignees_url":"https://api.github.com/repos/google/google-auth-library-nodejs/assignees{/user}","branches_url":"https://api.github.com/repos/google/google-auth-library-nodejs/branches{/branch}","tags_url":"https://api.github.com/repos/google/google-auth-library-nodejs/tags","blobs_url":"https://api.github.com/repos/google/google-auth-library-nodejs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/google-auth-library-nodejs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/google-auth-library-nodejs/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/google-auth-library-nodejs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/google-auth-library-nodejs/statuses/{sha}","languages_url":"https://api.github.com/repos/google/google-auth-library-nodejs/languages","stargazers_url":"https://api.github.com/repos/google/google-auth-library-nodejs/stargazers","contributors_url":"https://api.github.com/repos/google/google-auth-library-nodejs/contributors","subscribers_url":"https://api.github.com/repos/google/google-auth-library-nodejs/subscribers","subscription_url":"https://api.github.com/repos/google/google-auth-library-nodejs/subscription","commits_url":"https://api.github.com/repos/google/google-auth-library-nodejs/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/google-auth-library-nodejs/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/google-auth-library-nodejs/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/google-auth-library-nodejs/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/google-auth-library-nodejs/contents/{+path}","compare_url":"https://api.github.com/repos/google/google-auth-library-nodejs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/google-auth-library-nodejs/merges","archive_url":"https://api.github.com/repos/google/google-auth-library-nodejs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/google-auth-library-nodejs/downloads","issues_url":"https://api.github.com/repos/google/google-auth-library-nodejs/issues{/number}","pulls_url":"https://api.github.com/repos/google/google-auth-library-nodejs/pulls{/number}","milestones_url":"https://api.github.com/repos/google/google-auth-library-nodejs/milestones{/number}","notifications_url":"https://api.github.com/repos/google/google-auth-library-nodejs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/google-auth-library-nodejs/labels{/name}","releases_url":"https://api.github.com/repos/google/google-auth-library-nodejs/releases{/id}","deployments_url":"https://api.github.com/repos/google/google-auth-library-nodejs/deployments","created_at":"2015-02-11T23:52:54Z","updated_at":"2017-04-24T01:37:50Z","pushed_at":"2017-04-22T23:09:32Z","git_url":"git://github.com/google/google-auth-library-nodejs.git","ssh_url":"git@github.com:google/google-auth-library-nodejs.git","clone_url":"https://github.com/google/google-auth-library-nodejs.git","svn_url":"https://github.com/google/google-auth-library-nodejs","homepage":"","size":230,"stargazers_count":195,"watchers_count":195,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":98,"mirror_url":null,"open_issues_count":35,"forks":98,"open_issues":35,"watchers":195,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/google-auth-library-nodejs/pulls/135"},"html":{"href":"https://github.com/google/google-auth-library-nodejs/pull/135"},"issue":{"href":"https://api.github.com/repos/google/google-auth-library-nodejs/issues/135"},"comments":{"href":"https://api.github.com/repos/google/google-auth-library-nodejs/issues/135/comments"},"review_comments":{"href":"https://api.github.com/repos/google/google-auth-library-nodejs/pulls/135/comments"},"review_comment":{"href":"https://api.github.com/repos/google/google-auth-library-nodejs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/google-auth-library-nodejs/pulls/135/commits"},"statuses":{"href":"https://api.github.com/repos/google/google-auth-library-nodejs/statuses/e5fdec19199d2d2e7d68086d3f252cecf6cd6a76"}}}}
{"actor":{"display_login":"matthewloring"}}