{"action":"created","comment":{"url":"https://api.github.com/repos/firebase/firebase-admin-go/pulls/comments/194534532","pull_request_review_id":127725706,"id":194534532,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDUzNDUzMg==","diff_hunk":"@@ -161,6 +175,23 @@ func TestRevokeRefreshTokens(t *testing.T) {\n \t}\n }\n \n+func verifyCustomToken(t *testing.T, ct, uid string) *auth.Token {\n+\tidt, err := signInWithCustomToken(ct)\n+\tif err != nil {\n+\t\tt.Fatal(err)\n+\t}\n+\tdefer deleteUser(uid)","path":"integration/auth/auth_test.go","position":90,"original_position":90,"commit_id":"ab9953c990d1c3a6d62d9ff24f31dba42bcd8f19","original_commit_id":"ab9953c990d1c3a6d62d9ff24f31dba42bcd8f19","user":{"login":"bklimt","id":1392500,"node_id":"MDQ6VXNlcjEzOTI1MDA=","avatar_url":"https://avatars1.githubusercontent.com/u/1392500?v=4","gravatar_id":"","url":"https://api.github.com/users/bklimt","html_url":"https://github.com/bklimt","followers_url":"https://api.github.com/users/bklimt/followers","following_url":"https://api.github.com/users/bklimt/following{/other_user}","gists_url":"https://api.github.com/users/bklimt/gists{/gist_id}","starred_url":"https://api.github.com/users/bklimt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bklimt/subscriptions","organizations_url":"https://api.github.com/users/bklimt/orgs","repos_url":"https://api.github.com/users/bklimt/repos","events_url":"https://api.github.com/users/bklimt/events{/privacy}","received_events_url":"https://api.github.com/users/bklimt/received_events","type":"User","site_admin":false},"body":"I would add a comment for this function clarifying that, in addition to verifying the token, this function creates and deletes the user with the given UID.\r\n\r\nYou know, it might actually make more sense to get the uid out of `ct`, if possible. Otherwise, there's the small chance of passing in the wrong uid.","created_at":"2018-06-11T20:20:37Z","updated_at":"2018-06-11T20:31:41Z","html_url":"https://github.com/firebase/firebase-admin-go/pull/155#discussion_r194534532","pull_request_url":"https://api.github.com/repos/firebase/firebase-admin-go/pulls/155","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/firebase/firebase-admin-go/pulls/comments/194534532"},"html":{"href":"https://github.com/firebase/firebase-admin-go/pull/155#discussion_r194534532"},"pull_request":{"href":"https://api.github.com/repos/firebase/firebase-admin-go/pulls/155"}}},"pull_request":{"url":"https://api.github.com/repos/firebase/firebase-admin-go/pulls/155","id":192110245,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyMTEwMjQ1","html_url":"https://github.com/firebase/firebase-admin-go/pull/155","diff_url":"https://github.com/firebase/firebase-admin-go/pull/155.diff","patch_url":"https://github.com/firebase/firebase-admin-go/pull/155.patch","issue_url":"https://api.github.com/repos/firebase/firebase-admin-go/issues/155","number":155,"state":"open","locked":false,"title":"Support for creating custom tokens without service account credentials","user":{"login":"hiranya911","id":2375201,"node_id":"MDQ6VXNlcjIzNzUyMDE=","avatar_url":"https://avatars1.githubusercontent.com/u/2375201?v=4","gravatar_id":"","url":"https://api.github.com/users/hiranya911","html_url":"https://github.com/hiranya911","followers_url":"https://api.github.com/users/hiranya911/followers","following_url":"https://api.github.com/users/hiranya911/following{/other_user}","gists_url":"https://api.github.com/users/hiranya911/gists{/gist_id}","starred_url":"https://api.github.com/users/hiranya911/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hiranya911/subscriptions","organizations_url":"https://api.github.com/users/hiranya911/orgs","repos_url":"https://api.github.com/users/hiranya911/repos","events_url":"https://api.github.com/users/hiranya911/events{/privacy}","received_events_url":"https://api.github.com/users/hiranya911/received_events","type":"User","site_admin":false},"body":"Currently the SDK must be initialized with service account credentials in order to be able to call FirebaseAuth.createCustomToken(). With this PR, the SDK will attempt to sign custom tokens by calling the IAM service in the cloud when the service account credentials are not provided.\r\n\r\n```\r\n// Following will work in GCP managed runtimes where the Metadata service is present\r\napp, err := firebase.NewApp(ctx, nil)\r\n...\r\ntoken, err := client.CustomToken(uid)\r\n```\r\n\r\n```\r\n// Following will work anywhere\r\napp, err := firebase.NewApp(ctx, &firebase.Config{\r\n    ServiceAccount: \"test-service-account@project-id.iam.gserviceaccount.com\",\r\n})\r\n...\r\ntoken, err := client.CustomToken(uid)\r\n```\r\n\r\nI'm also refactoring the `auth` package a little bit by:\r\n* Moving all token creation utils to a new `token_generator.go` file\r\n* Moving all token verification utils to a new `token_verifier.go` file\r\n* Removing `crypto.go` and `jwt.go` files\r\n\r\ngo/firebase-admin-sign\r\ngo/firebase-admin-iam-sign","created_at":"2018-06-01T18:31:43Z","updated_at":"2018-06-11T20:31:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8bd3d79105dc8637928ca8faff5ed080feea0238","assignee":{"login":"bklimt","id":1392500,"node_id":"MDQ6VXNlcjEzOTI1MDA=","avatar_url":"https://avatars1.githubusercontent.com/u/1392500?v=4","gravatar_id":"","url":"https://api.github.com/users/bklimt","html_url":"https://github.com/bklimt","followers_url":"https://api.github.com/users/bklimt/followers","following_url":"https://api.github.com/users/bklimt/following{/other_user}","gists_url":"https://api.github.com/users/bklimt/gists{/gist_id}","starred_url":"https://api.github.com/users/bklimt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bklimt/subscriptions","organizations_url":"https://api.github.com/users/bklimt/orgs","repos_url":"https://api.github.com/users/bklimt/repos","events_url":"https://api.github.com/users/bklimt/events{/privacy}","received_events_url":"https://api.github.com/users/bklimt/received_events","type":"User","site_admin":false},"assignees":[{"login":"bklimt","id":1392500,"node_id":"MDQ6VXNlcjEzOTI1MDA=","avatar_url":"https://avatars1.githubusercontent.com/u/1392500?v=4","gravatar_id":"","url":"https://api.github.com/users/bklimt","html_url":"https://github.com/bklimt","followers_url":"https://api.github.com/users/bklimt/followers","following_url":"https://api.github.com/users/bklimt/following{/other_user}","gists_url":"https://api.github.com/users/bklimt/gists{/gist_id}","starred_url":"https://api.github.com/users/bklimt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bklimt/subscriptions","organizations_url":"https://api.github.com/users/bklimt/orgs","repos_url":"https://api.github.com/users/bklimt/repos","events_url":"https://api.github.com/users/bklimt/events{/privacy}","received_events_url":"https://api.github.com/users/bklimt/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/firebase/firebase-admin-go/pulls/155/commits","review_comments_url":"https://api.github.com/repos/firebase/firebase-admin-go/pulls/155/comments","review_comment_url":"https://api.github.com/repos/firebase/firebase-admin-go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/firebase/firebase-admin-go/issues/155/comments","statuses_url":"https://api.github.com/repos/firebase/firebase-admin-go/statuses/ab9953c990d1c3a6d62d9ff24f31dba42bcd8f19","head":{"label":"firebase:hkj-jwt-sign","ref":"hkj-jwt-sign","sha":"ab9953c990d1c3a6d62d9ff24f31dba42bcd8f19","user":{"login":"firebase","id":1335026,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMzUwMjY=","avatar_url":"https://avatars2.githubusercontent.com/u/1335026?v=4","gravatar_id":"","url":"https://api.github.com/users/firebase","html_url":"https://github.com/firebase","followers_url":"https://api.github.com/users/firebase/followers","following_url":"https://api.github.com/users/firebase/following{/other_user}","gists_url":"https://api.github.com/users/firebase/gists{/gist_id}","starred_url":"https://api.github.com/users/firebase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firebase/subscriptions","organizations_url":"https://api.github.com/users/firebase/orgs","repos_url":"https://api.github.com/users/firebase/repos","events_url":"https://api.github.com/users/firebase/events{/privacy}","received_events_url":"https://api.github.com/users/firebase/received_events","type":"Organization","site_admin":false},"repo":{"id":84979182,"node_id":"MDEwOlJlcG9zaXRvcnk4NDk3OTE4Mg==","name":"firebase-admin-go","full_name":"firebase/firebase-admin-go","owner":{"login":"firebase","id":1335026,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMzUwMjY=","avatar_url":"https://avatars2.githubusercontent.com/u/1335026?v=4","gravatar_id":"","url":"https://api.github.com/users/firebase","html_url":"https://github.com/firebase","followers_url":"https://api.github.com/users/firebase/followers","following_url":"https://api.github.com/users/firebase/following{/other_user}","gists_url":"https://api.github.com/users/firebase/gists{/gist_id}","starred_url":"https://api.github.com/users/firebase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firebase/subscriptions","organizations_url":"https://api.github.com/users/firebase/orgs","repos_url":"https://api.github.com/users/firebase/repos","events_url":"https://api.github.com/users/firebase/events{/privacy}","received_events_url":"https://api.github.com/users/firebase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/firebase/firebase-admin-go","description":"Firebase Admin Go SDK","fork":false,"url":"https://api.github.com/repos/firebase/firebase-admin-go","forks_url":"https://api.github.com/repos/firebase/firebase-admin-go/forks","keys_url":"https://api.github.com/repos/firebase/firebase-admin-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/firebase/firebase-admin-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/firebase/firebase-admin-go/teams","hooks_url":"https://api.github.com/repos/firebase/firebase-admin-go/hooks","issue_events_url":"https://api.github.com/repos/firebase/firebase-admin-go/issues/events{/number}","events_url":"https://api.github.com/repos/firebase/firebase-admin-go/events","assignees_url":"https://api.github.com/repos/firebase/firebase-admin-go/assignees{/user}","branches_url":"https://api.github.com/repos/firebase/firebase-admin-go/branches{/branch}","tags_url":"https://api.github.com/repos/firebase/firebase-admin-go/tags","blobs_url":"https://api.github.com/repos/firebase/firebase-admin-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/firebase/firebase-admin-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/firebase/firebase-admin-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/firebase/firebase-admin-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/firebase/firebase-admin-go/statuses/{sha}","languages_url":"https://api.github.com/repos/firebase/firebase-admin-go/languages","stargazers_url":"https://api.github.com/repos/firebase/firebase-admin-go/stargazers","contributors_url":"https://api.github.com/repos/firebase/firebase-admin-go/contributors","subscribers_url":"https://api.github.com/repos/firebase/firebase-admin-go/subscribers","subscription_url":"https://api.github.com/repos/firebase/firebase-admin-go/subscription","commits_url":"https://api.github.com/repos/firebase/firebase-admin-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/firebase/firebase-admin-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/firebase/firebase-admin-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/firebase/firebase-admin-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/firebase/firebase-admin-go/contents/{+path}","compare_url":"https://api.github.com/repos/firebase/firebase-admin-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/firebase/firebase-admin-go/merges","archive_url":"https://api.github.com/repos/firebase/firebase-admin-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/firebase/firebase-admin-go/downloads","issues_url":"https://api.github.com/repos/firebase/firebase-admin-go/issues{/number}","pulls_url":"https://api.github.com/repos/firebase/firebase-admin-go/pulls{/number}","milestones_url":"https://api.github.com/repos/firebase/firebase-admin-go/milestones{/number}","notifications_url":"https://api.github.com/repos/firebase/firebase-admin-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/firebase/firebase-admin-go/labels{/name}","releases_url":"https://api.github.com/repos/firebase/firebase-admin-go/releases{/id}","deployments_url":"https://api.github.com/repos/firebase/firebase-admin-go/deployments","created_at":"2017-03-14T17:40:38Z","updated_at":"2018-06-06T08:35:52Z","pushed_at":"2018-06-11T19:16:22Z","git_url":"git://github.com/firebase/firebase-admin-go.git","ssh_url":"git@github.com:firebase/firebase-admin-go.git","clone_url":"https://github.com/firebase/firebase-admin-go.git","svn_url":"https://github.com/firebase/firebase-admin-go","homepage":null,"size":445,"stargazers_count":192,"watchers_count":192,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"archived":false,"open_issues_count":12,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":31,"open_issues":12,"watchers":192,"default_branch":"master"}},"base":{"label":"firebase:dev","ref":"dev","sha":"2554cb5bb7ba1ca40efa578b03ac661f6be47591","user":{"login":"firebase","id":1335026,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMzUwMjY=","avatar_url":"https://avatars2.githubusercontent.com/u/1335026?v=4","gravatar_id":"","url":"https://api.github.com/users/firebase","html_url":"https://github.com/firebase","followers_url":"https://api.github.com/users/firebase/followers","following_url":"https://api.github.com/users/firebase/following{/other_user}","gists_url":"https://api.github.com/users/firebase/gists{/gist_id}","starred_url":"https://api.github.com/users/firebase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firebase/subscriptions","organizations_url":"https://api.github.com/users/firebase/orgs","repos_url":"https://api.github.com/users/firebase/repos","events_url":"https://api.github.com/users/firebase/events{/privacy}","received_events_url":"https://api.github.com/users/firebase/received_events","type":"Organization","site_admin":false},"repo":{"id":84979182,"node_id":"MDEwOlJlcG9zaXRvcnk4NDk3OTE4Mg==","name":"firebase-admin-go","full_name":"firebase/firebase-admin-go","owner":{"login":"firebase","id":1335026,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMzUwMjY=","avatar_url":"https://avatars2.githubusercontent.com/u/1335026?v=4","gravatar_id":"","url":"https://api.github.com/users/firebase","html_url":"https://github.com/firebase","followers_url":"https://api.github.com/users/firebase/followers","following_url":"https://api.github.com/users/firebase/following{/other_user}","gists_url":"https://api.github.com/users/firebase/gists{/gist_id}","starred_url":"https://api.github.com/users/firebase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firebase/subscriptions","organizations_url":"https://api.github.com/users/firebase/orgs","repos_url":"https://api.github.com/users/firebase/repos","events_url":"https://api.github.com/users/firebase/events{/privacy}","received_events_url":"https://api.github.com/users/firebase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/firebase/firebase-admin-go","description":"Firebase Admin Go SDK","fork":false,"url":"https://api.github.com/repos/firebase/firebase-admin-go","forks_url":"https://api.github.com/repos/firebase/firebase-admin-go/forks","keys_url":"https://api.github.com/repos/firebase/firebase-admin-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/firebase/firebase-admin-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/firebase/firebase-admin-go/teams","hooks_url":"https://api.github.com/repos/firebase/firebase-admin-go/hooks","issue_events_url":"https://api.github.com/repos/firebase/firebase-admin-go/issues/events{/number}","events_url":"https://api.github.com/repos/firebase/firebase-admin-go/events","assignees_url":"https://api.github.com/repos/firebase/firebase-admin-go/assignees{/user}","branches_url":"https://api.github.com/repos/firebase/firebase-admin-go/branches{/branch}","tags_url":"https://api.github.com/repos/firebase/firebase-admin-go/tags","blobs_url":"https://api.github.com/repos/firebase/firebase-admin-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/firebase/firebase-admin-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/firebase/firebase-admin-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/firebase/firebase-admin-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/firebase/firebase-admin-go/statuses/{sha}","languages_url":"https://api.github.com/repos/firebase/firebase-admin-go/languages","stargazers_url":"https://api.github.com/repos/firebase/firebase-admin-go/stargazers","contributors_url":"https://api.github.com/repos/firebase/firebase-admin-go/contributors","subscribers_url":"https://api.github.com/repos/firebase/firebase-admin-go/subscribers","subscription_url":"https://api.github.com/repos/firebase/firebase-admin-go/subscription","commits_url":"https://api.github.com/repos/firebase/firebase-admin-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/firebase/firebase-admin-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/firebase/firebase-admin-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/firebase/firebase-admin-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/firebase/firebase-admin-go/contents/{+path}","compare_url":"https://api.github.com/repos/firebase/firebase-admin-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/firebase/firebase-admin-go/merges","archive_url":"https://api.github.com/repos/firebase/firebase-admin-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/firebase/firebase-admin-go/downloads","issues_url":"https://api.github.com/repos/firebase/firebase-admin-go/issues{/number}","pulls_url":"https://api.github.com/repos/firebase/firebase-admin-go/pulls{/number}","milestones_url":"https://api.github.com/repos/firebase/firebase-admin-go/milestones{/number}","notifications_url":"https://api.github.com/repos/firebase/firebase-admin-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/firebase/firebase-admin-go/labels{/name}","releases_url":"https://api.github.com/repos/firebase/firebase-admin-go/releases{/id}","deployments_url":"https://api.github.com/repos/firebase/firebase-admin-go/deployments","created_at":"2017-03-14T17:40:38Z","updated_at":"2018-06-06T08:35:52Z","pushed_at":"2018-06-11T19:16:22Z","git_url":"git://github.com/firebase/firebase-admin-go.git","ssh_url":"git@github.com:firebase/firebase-admin-go.git","clone_url":"https://github.com/firebase/firebase-admin-go.git","svn_url":"https://github.com/firebase/firebase-admin-go","homepage":null,"size":445,"stargazers_count":192,"watchers_count":192,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"archived":false,"open_issues_count":12,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":31,"open_issues":12,"watchers":192,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/firebase/firebase-admin-go/pulls/155"},"html":{"href":"https://github.com/firebase/firebase-admin-go/pull/155"},"issue":{"href":"https://api.github.com/repos/firebase/firebase-admin-go/issues/155"},"comments":{"href":"https://api.github.com/repos/firebase/firebase-admin-go/issues/155/comments"},"review_comments":{"href":"https://api.github.com/repos/firebase/firebase-admin-go/pulls/155/comments"},"review_comment":{"href":"https://api.github.com/repos/firebase/firebase-admin-go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/firebase/firebase-admin-go/pulls/155/commits"},"statuses":{"href":"https://api.github.com/repos/firebase/firebase-admin-go/statuses/ab9953c990d1c3a6d62d9ff24f31dba42bcd8f19"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"bklimt"}}