{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/application-services/pulls/comments/232425431","pull_request_review_id":173631043,"id":232425431,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjQyNTQzMQ==","diff_hunk":"@@ -6,34 +6,33 @@ package org.mozilla.fxaclient.internal\n \n import com.sun.jna.Pointer\n import com.sun.jna.Structure\n-\n-import java.util.Arrays\n+import java.util.*\n \n class OAuthInfo internal constructor(raw: Raw) {\n \n-    val accessToken: String?\n-    val keys: String?\n-    val scope: String?\n+    val accessToken: String\n+    val key: String?\n+    val expiresAt: Date\n \n     class Raw(p: Pointer) : Structure(p) {\n         @JvmField var accessToken: Pointer? = null\n-        @JvmField var keys: Pointer? = null\n-        @JvmField var scope: Pointer? = null\n+        @JvmField var key: Pointer? = null\n+        @JvmField var expiresAt: Long = 0 // In seconds.\n \n         init {\n             read()\n         }\n \n         override fun getFieldOrder(): List<String> {\n-            return Arrays.asList(\"accessToken\", \"keys\", \"scope\")\n+            return Arrays.asList(\"accessToken\", \"key\", \"expiresAt\")\n         }\n     }\n \n     init {\n         try {\n-            this.accessToken = raw.accessToken?.getRustString()\n-            this.keys = raw.keys?.getRustString()\n-            this.scope = raw.scope?.getRustString()\n+            this.accessToken = raw.accessToken?.getRustString()!! // This field is always present.","path":"fxa-client/sdks/android/library/src/main/java/org/mozilla/fxaclient/internal/OAuthInfo.kt","position":39,"original_position":39,"commit_id":"59ab857f39b138c4adb61ccb8287faac20969a19","original_commit_id":"59ab857f39b138c4adb61ccb8287faac20969a19","user":{"login":"eoger","id":6424575,"node_id":"MDQ6VXNlcjY0MjQ1NzU=","avatar_url":"https://avatars1.githubusercontent.com/u/6424575?v=4","gravatar_id":"","url":"https://api.github.com/users/eoger","html_url":"https://github.com/eoger","followers_url":"https://api.github.com/users/eoger/followers","following_url":"https://api.github.com/users/eoger/following{/other_user}","gists_url":"https://api.github.com/users/eoger/gists{/gist_id}","starred_url":"https://api.github.com/users/eoger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eoger/subscriptions","organizations_url":"https://api.github.com/users/eoger/orgs","repos_url":"https://api.github.com/users/eoger/repos","events_url":"https://api.github.com/users/eoger/events{/privacy}","received_events_url":"https://api.github.com/users/eoger/received_events","type":"User","site_admin":false},"body":"I don't think it is worth it as serialization to AuthInfoC will fail if we can't create that string, but let's see what Thom says.","created_at":"2018-11-09T23:48:19Z","updated_at":"2018-11-09T23:48:19Z","html_url":"https://github.com/mozilla/application-services/pull/388#discussion_r232425431","pull_request_url":"https://api.github.com/repos/mozilla/application-services/pulls/388","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/mozilla/application-services/pulls/comments/232425431"},"html":{"href":"https://github.com/mozilla/application-services/pull/388#discussion_r232425431"},"pull_request":{"href":"https://api.github.com/repos/mozilla/application-services/pulls/388"}},"in_reply_to_id":232410675},"pull_request":{"url":"https://api.github.com/repos/mozilla/application-services/pulls/388","id":229831691,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5ODMxNjkx","html_url":"https://github.com/mozilla/application-services/pull/388","diff_url":"https://github.com/mozilla/application-services/pull/388.diff","patch_url":"https://github.com/mozilla/application-services/pull/388.patch","issue_url":"https://api.github.com/repos/mozilla/application-services/issues/388","number":388,"state":"open","locked":false,"title":"Refactor tokens","user":{"login":"eoger","id":6424575,"node_id":"MDQ6VXNlcjY0MjQ1NzU=","avatar_url":"https://avatars1.githubusercontent.com/u/6424575?v=4","gravatar_id":"","url":"https://api.github.com/users/eoger","html_url":"https://github.com/eoger","followers_url":"https://api.github.com/users/eoger/followers","following_url":"https://api.github.com/users/eoger/following{/other_user}","gists_url":"https://api.github.com/users/eoger/gists{/gist_id}","starred_url":"https://api.github.com/users/eoger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eoger/subscriptions","organizations_url":"https://api.github.com/users/eoger/orgs","repos_url":"https://api.github.com/users/eoger/repos","events_url":"https://api.github.com/users/eoger/events{/privacy}","received_events_url":"https://api.github.com/users/eoger/received_events","type":"User","site_admin":false},"body":"What does this do:\r\n- Only one refresh token is stored per account now: if new scopes are requested, the stored token is destroyed and a new one is requested, with scopes = `UNION([held scopes], [requested scopes])` (aka \"fake incremental OAuth\").\r\n  - This involves an account data migration (the first one!) where we keep the most recently obtained refresh token.\r\n  - This integrates nicely with the OAuth Client Instances API project where 1 refresh token == 1 client instance. (Helps us with #40)\r\n- Keys are now stored separately and are returned every time `get_oauth_token` is called. (Fixes #379)\r\n- OAuth Access Tokens are cached in memory, but are not persisted anymore.\r\n- As a consequence of the implementation of previous bullet, we do not return over-scoped OAuth Tokens anymore. (Fixes #386)\r\n- API Changes: (Fixes #381)\r\n  - `complete_oauth_flow` doesn't return `OAuthInfo` anymore. Why? The common case is a consumer requesting a set of scopes upfront during the \"login flow\", but then requesting a scope (+scoped key) one by one using `get_oauth_token` (which now takes only a single scope).\r\n - `get_oauth_token` doesn't return \"raw\" OAuth tokens anymore. Only one scoped key is contained in a `OAuthInfo`.\r\n\r\n\r\n@thomcc if you don't mind could you have a look at the FFI parts?","created_at":"2018-11-09T22:03:13Z","updated_at":"2018-11-09T23:48:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"229582fcf137da94a6d1508643da1a680599fc10","assignee":null,"assignees":[],"requested_reviewers":[{"login":"rfk","id":34695,"node_id":"MDQ6VXNlcjM0Njk1","avatar_url":"https://avatars3.githubusercontent.com/u/34695?v=4","gravatar_id":"","url":"https://api.github.com/users/rfk","html_url":"https://github.com/rfk","followers_url":"https://api.github.com/users/rfk/followers","following_url":"https://api.github.com/users/rfk/following{/other_user}","gists_url":"https://api.github.com/users/rfk/gists{/gist_id}","starred_url":"https://api.github.com/users/rfk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfk/subscriptions","organizations_url":"https://api.github.com/users/rfk/orgs","repos_url":"https://api.github.com/users/rfk/repos","events_url":"https://api.github.com/users/rfk/events{/privacy}","received_events_url":"https://api.github.com/users/rfk/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/application-services/pulls/388/commits","review_comments_url":"https://api.github.com/repos/mozilla/application-services/pulls/388/comments","review_comment_url":"https://api.github.com/repos/mozilla/application-services/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/application-services/issues/388/comments","statuses_url":"https://api.github.com/repos/mozilla/application-services/statuses/59ab857f39b138c4adb61ccb8287faac20969a19","head":{"label":"mozilla:tokens-refactor","ref":"tokens-refactor","sha":"59ab857f39b138c4adb61ccb8287faac20969a19","user":{"login":"mozilla","id":131524,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMTUyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":129966583,"node_id":"MDEwOlJlcG9zaXRvcnkxMjk5NjY1ODM=","name":"application-services","full_name":"mozilla/application-services","private":false,"owner":{"login":"mozilla","id":131524,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMTUyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mozilla/application-services","description":"Firefox Application Services","fork":false,"url":"https://api.github.com/repos/mozilla/application-services","forks_url":"https://api.github.com/repos/mozilla/application-services/forks","keys_url":"https://api.github.com/repos/mozilla/application-services/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/application-services/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/application-services/teams","hooks_url":"https://api.github.com/repos/mozilla/application-services/hooks","issue_events_url":"https://api.github.com/repos/mozilla/application-services/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/application-services/events","assignees_url":"https://api.github.com/repos/mozilla/application-services/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/application-services/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/application-services/tags","blobs_url":"https://api.github.com/repos/mozilla/application-services/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/application-services/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/application-services/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/application-services/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/application-services/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/application-services/languages","stargazers_url":"https://api.github.com/repos/mozilla/application-services/stargazers","contributors_url":"https://api.github.com/repos/mozilla/application-services/contributors","subscribers_url":"https://api.github.com/repos/mozilla/application-services/subscribers","subscription_url":"https://api.github.com/repos/mozilla/application-services/subscription","commits_url":"https://api.github.com/repos/mozilla/application-services/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/application-services/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/application-services/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/application-services/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/application-services/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/application-services/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/application-services/merges","archive_url":"https://api.github.com/repos/mozilla/application-services/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/application-services/downloads","issues_url":"https://api.github.com/repos/mozilla/application-services/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/application-services/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/application-services/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/application-services/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/application-services/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/application-services/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/application-services/deployments","created_at":"2018-04-17T21:20:37Z","updated_at":"2018-11-08T23:27:09Z","pushed_at":"2018-11-09T22:07:55Z","git_url":"git://github.com/mozilla/application-services.git","ssh_url":"git@github.com:mozilla/application-services.git","clone_url":"https://github.com/mozilla/application-services.git","svn_url":"https://github.com/mozilla/application-services","homepage":"https://mozilla.github.io/application-services/","size":41956,"stargazers_count":32,"watchers_count":32,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":17,"mirror_url":null,"archived":false,"open_issues_count":72,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":17,"open_issues":72,"watchers":32,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"b5e65443c7e0c321fe0692e323527b08ca89d49f","user":{"login":"mozilla","id":131524,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMTUyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":129966583,"node_id":"MDEwOlJlcG9zaXRvcnkxMjk5NjY1ODM=","name":"application-services","full_name":"mozilla/application-services","private":false,"owner":{"login":"mozilla","id":131524,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMTUyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mozilla/application-services","description":"Firefox Application Services","fork":false,"url":"https://api.github.com/repos/mozilla/application-services","forks_url":"https://api.github.com/repos/mozilla/application-services/forks","keys_url":"https://api.github.com/repos/mozilla/application-services/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/application-services/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/application-services/teams","hooks_url":"https://api.github.com/repos/mozilla/application-services/hooks","issue_events_url":"https://api.github.com/repos/mozilla/application-services/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/application-services/events","assignees_url":"https://api.github.com/repos/mozilla/application-services/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/application-services/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/application-services/tags","blobs_url":"https://api.github.com/repos/mozilla/application-services/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/application-services/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/application-services/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/application-services/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/application-services/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/application-services/languages","stargazers_url":"https://api.github.com/repos/mozilla/application-services/stargazers","contributors_url":"https://api.github.com/repos/mozilla/application-services/contributors","subscribers_url":"https://api.github.com/repos/mozilla/application-services/subscribers","subscription_url":"https://api.github.com/repos/mozilla/application-services/subscription","commits_url":"https://api.github.com/repos/mozilla/application-services/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/application-services/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/application-services/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/application-services/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/application-services/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/application-services/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/application-services/merges","archive_url":"https://api.github.com/repos/mozilla/application-services/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/application-services/downloads","issues_url":"https://api.github.com/repos/mozilla/application-services/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/application-services/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/application-services/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/application-services/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/application-services/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/application-services/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/application-services/deployments","created_at":"2018-04-17T21:20:37Z","updated_at":"2018-11-08T23:27:09Z","pushed_at":"2018-11-09T22:07:55Z","git_url":"git://github.com/mozilla/application-services.git","ssh_url":"git@github.com:mozilla/application-services.git","clone_url":"https://github.com/mozilla/application-services.git","svn_url":"https://github.com/mozilla/application-services","homepage":"https://mozilla.github.io/application-services/","size":41956,"stargazers_count":32,"watchers_count":32,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":17,"mirror_url":null,"archived":false,"open_issues_count":72,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":17,"open_issues":72,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/application-services/pulls/388"},"html":{"href":"https://github.com/mozilla/application-services/pull/388"},"issue":{"href":"https://api.github.com/repos/mozilla/application-services/issues/388"},"comments":{"href":"https://api.github.com/repos/mozilla/application-services/issues/388/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/application-services/pulls/388/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/application-services/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/application-services/pulls/388/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/application-services/statuses/59ab857f39b138c4adb61ccb8287faac20969a19"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"eoger"}}