{"action":"created","comment":{"url":"https://api.github.com/repos/edx/django-oauth2-provider/pulls/comments/27530768","id":27530768,"diff_hunk":"@@ -137,3 +145,35 @@ def invalidate_access_token(self, at):\n         else:\n             at.expires = now() - timedelta(days=1)\n             at.save()\n+\n+\n+class AccessTokenDetailView(View):\n+    \"\"\"\n+    This view returns info about a given access token. If the token does not exist or is expired, HTTP 400 is returned.\n+\n+    A successful response has HTTP status 200 and includes a JSON object containing the username, scope, and expiry\n+    time (in seconds) for the access token.\n+\n+    Example\n+        GET /access_token/abc123/\n+\n+        {\n+            username: \"some-user\",\n+            scope: \"read\",\n+            expires_in: 60\n+        }\n+    \"\"\"\n+\n+    def get(self, request, *args, **kwargs):\n+        JSON_CONTENT_TYPE = 'application/json'\n+\n+        try:\n+            access_token = AccessToken.objects.get_token(kwargs['token'])\n+            content = {\n+                'username': access_token.user.username,\n+                'scope': access_token.get_scope_display(),\n+                'expires_in': access_token.get_expire_delta()","path":"provider/oauth2/views.py","position":59,"original_position":59,"commit_id":"656aa922e9409ae7e7a6c406f568e78b62a34fc4","original_commit_id":"656aa922e9409ae7e7a6c406f568e78b62a34fc4","user":{"login":"nasthagiri","id":6772826,"avatar_url":"https://avatars.githubusercontent.com/u/6772826?v=3","gravatar_id":"","url":"https://api.github.com/users/nasthagiri","html_url":"https://github.com/nasthagiri","followers_url":"https://api.github.com/users/nasthagiri/followers","following_url":"https://api.github.com/users/nasthagiri/following{/other_user}","gists_url":"https://api.github.com/users/nasthagiri/gists{/gist_id}","starred_url":"https://api.github.com/users/nasthagiri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nasthagiri/subscriptions","organizations_url":"https://api.github.com/users/nasthagiri/orgs","repos_url":"https://api.github.com/users/nasthagiri/repos","events_url":"https://api.github.com/users/nasthagiri/events{/privacy}","received_events_url":"https://api.github.com/users/nasthagiri/received_events","type":"User","site_admin":false},"body":"Why did you choose to return `expires_in` instead of `expires`?  I would think the latter would be more useful for clients since they don't have to remember exactly what time they called the API.","created_at":"2015-03-31T22:46:21Z","updated_at":"2015-03-31T22:46:21Z","html_url":"https://github.com/edx/django-oauth2-provider/pull/9#discussion_r27530768","pull_request_url":"https://api.github.com/repos/edx/django-oauth2-provider/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/edx/django-oauth2-provider/pulls/comments/27530768"},"html":{"href":"https://github.com/edx/django-oauth2-provider/pull/9#discussion_r27530768"},"pull_request":{"href":"https://api.github.com/repos/edx/django-oauth2-provider/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/edx/django-oauth2-provider/pulls/9","id":32291654,"html_url":"https://github.com/edx/django-oauth2-provider/pull/9","diff_url":"https://github.com/edx/django-oauth2-provider/pull/9.diff","patch_url":"https://github.com/edx/django-oauth2-provider/pull/9.patch","issue_url":"https://api.github.com/repos/edx/django-oauth2-provider/issues/9","number":9,"state":"closed","locked":false,"title":"Added access token detail view","user":{"login":"clintonb","id":910510,"avatar_url":"https://avatars.githubusercontent.com/u/910510?v=3","gravatar_id":"","url":"https://api.github.com/users/clintonb","html_url":"https://github.com/clintonb","followers_url":"https://api.github.com/users/clintonb/followers","following_url":"https://api.github.com/users/clintonb/following{/other_user}","gists_url":"https://api.github.com/users/clintonb/gists{/gist_id}","starred_url":"https://api.github.com/users/clintonb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintonb/subscriptions","organizations_url":"https://api.github.com/users/clintonb/orgs","repos_url":"https://api.github.com/users/clintonb/repos","events_url":"https://api.github.com/users/clintonb/events{/privacy}","received_events_url":"https://api.github.com/users/clintonb/received_events","type":"User","site_admin":false},"body":"This view is useful for APIs not hosted on the authentication server to determine if a given access token is valid.\r\n\r\n@nasthagiri @rlucioni @stephensanchez","created_at":"2015-03-31T05:10:40Z","updated_at":"2015-03-31T22:46:21Z","closed_at":"2015-03-31T14:28:46Z","merged_at":"2015-03-31T14:28:46Z","merge_commit_sha":"05afe102008524c738c1c28afe06604dfc6ded78","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/django-oauth2-provider/pulls/9/commits","review_comments_url":"https://api.github.com/repos/edx/django-oauth2-provider/pulls/9/comments","review_comment_url":"https://api.github.com/repos/edx/django-oauth2-provider/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/django-oauth2-provider/issues/9/comments","statuses_url":"https://api.github.com/repos/edx/django-oauth2-provider/statuses/656aa922e9409ae7e7a6c406f568e78b62a34fc4","head":{"label":"edx:validate-access-token","ref":"validate-access-token","sha":"656aa922e9409ae7e7a6c406f568e78b62a34fc4","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":21163971,"name":"django-oauth2-provider","full_name":"edx/django-oauth2-provider","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/django-oauth2-provider","description":"Provide OAuth2 access to your app","fork":true,"url":"https://api.github.com/repos/edx/django-oauth2-provider","forks_url":"https://api.github.com/repos/edx/django-oauth2-provider/forks","keys_url":"https://api.github.com/repos/edx/django-oauth2-provider/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/django-oauth2-provider/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/django-oauth2-provider/teams","hooks_url":"https://api.github.com/repos/edx/django-oauth2-provider/hooks","issue_events_url":"https://api.github.com/repos/edx/django-oauth2-provider/issues/events{/number}","events_url":"https://api.github.com/repos/edx/django-oauth2-provider/events","assignees_url":"https://api.github.com/repos/edx/django-oauth2-provider/assignees{/user}","branches_url":"https://api.github.com/repos/edx/django-oauth2-provider/branches{/branch}","tags_url":"https://api.github.com/repos/edx/django-oauth2-provider/tags","blobs_url":"https://api.github.com/repos/edx/django-oauth2-provider/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/django-oauth2-provider/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/django-oauth2-provider/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/django-oauth2-provider/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/django-oauth2-provider/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/django-oauth2-provider/languages","stargazers_url":"https://api.github.com/repos/edx/django-oauth2-provider/stargazers","contributors_url":"https://api.github.com/repos/edx/django-oauth2-provider/contributors","subscribers_url":"https://api.github.com/repos/edx/django-oauth2-provider/subscribers","subscription_url":"https://api.github.com/repos/edx/django-oauth2-provider/subscription","commits_url":"https://api.github.com/repos/edx/django-oauth2-provider/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/django-oauth2-provider/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/django-oauth2-provider/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/django-oauth2-provider/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/django-oauth2-provider/contents/{+path}","compare_url":"https://api.github.com/repos/edx/django-oauth2-provider/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/django-oauth2-provider/merges","archive_url":"https://api.github.com/repos/edx/django-oauth2-provider/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/django-oauth2-provider/downloads","issues_url":"https://api.github.com/repos/edx/django-oauth2-provider/issues{/number}","pulls_url":"https://api.github.com/repos/edx/django-oauth2-provider/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/django-oauth2-provider/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/django-oauth2-provider/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/django-oauth2-provider/labels{/name}","releases_url":"https://api.github.com/repos/edx/django-oauth2-provider/releases{/id}","created_at":"2014-06-24T12:36:34Z","updated_at":"2015-03-31T14:28:47Z","pushed_at":"2015-03-31T14:29:26Z","git_url":"git://github.com/edx/django-oauth2-provider.git","ssh_url":"git@github.com:edx/django-oauth2-provider.git","clone_url":"https://github.com/edx/django-oauth2-provider.git","svn_url":"https://github.com/edx/django-oauth2-provider","homepage":"http://www.caffeinehit.com/work/code/django-oauth2-provider/","size":411,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":0,"forks":8,"open_issues":0,"watchers":0,"default_branch":"edx"}},"base":{"label":"edx:edx","ref":"edx","sha":"6a784e869dec4e50be99781765349f0b151ac5c9","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":21163971,"name":"django-oauth2-provider","full_name":"edx/django-oauth2-provider","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/django-oauth2-provider","description":"Provide OAuth2 access to your app","fork":true,"url":"https://api.github.com/repos/edx/django-oauth2-provider","forks_url":"https://api.github.com/repos/edx/django-oauth2-provider/forks","keys_url":"https://api.github.com/repos/edx/django-oauth2-provider/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/django-oauth2-provider/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/django-oauth2-provider/teams","hooks_url":"https://api.github.com/repos/edx/django-oauth2-provider/hooks","issue_events_url":"https://api.github.com/repos/edx/django-oauth2-provider/issues/events{/number}","events_url":"https://api.github.com/repos/edx/django-oauth2-provider/events","assignees_url":"https://api.github.com/repos/edx/django-oauth2-provider/assignees{/user}","branches_url":"https://api.github.com/repos/edx/django-oauth2-provider/branches{/branch}","tags_url":"https://api.github.com/repos/edx/django-oauth2-provider/tags","blobs_url":"https://api.github.com/repos/edx/django-oauth2-provider/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/django-oauth2-provider/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/django-oauth2-provider/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/django-oauth2-provider/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/django-oauth2-provider/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/django-oauth2-provider/languages","stargazers_url":"https://api.github.com/repos/edx/django-oauth2-provider/stargazers","contributors_url":"https://api.github.com/repos/edx/django-oauth2-provider/contributors","subscribers_url":"https://api.github.com/repos/edx/django-oauth2-provider/subscribers","subscription_url":"https://api.github.com/repos/edx/django-oauth2-provider/subscription","commits_url":"https://api.github.com/repos/edx/django-oauth2-provider/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/django-oauth2-provider/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/django-oauth2-provider/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/django-oauth2-provider/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/django-oauth2-provider/contents/{+path}","compare_url":"https://api.github.com/repos/edx/django-oauth2-provider/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/django-oauth2-provider/merges","archive_url":"https://api.github.com/repos/edx/django-oauth2-provider/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/django-oauth2-provider/downloads","issues_url":"https://api.github.com/repos/edx/django-oauth2-provider/issues{/number}","pulls_url":"https://api.github.com/repos/edx/django-oauth2-provider/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/django-oauth2-provider/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/django-oauth2-provider/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/django-oauth2-provider/labels{/name}","releases_url":"https://api.github.com/repos/edx/django-oauth2-provider/releases{/id}","created_at":"2014-06-24T12:36:34Z","updated_at":"2015-03-31T14:28:47Z","pushed_at":"2015-03-31T14:29:26Z","git_url":"git://github.com/edx/django-oauth2-provider.git","ssh_url":"git@github.com:edx/django-oauth2-provider.git","clone_url":"https://github.com/edx/django-oauth2-provider.git","svn_url":"https://github.com/edx/django-oauth2-provider","homepage":"http://www.caffeinehit.com/work/code/django-oauth2-provider/","size":411,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":0,"forks":8,"open_issues":0,"watchers":0,"default_branch":"edx"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/django-oauth2-provider/pulls/9"},"html":{"href":"https://github.com/edx/django-oauth2-provider/pull/9"},"issue":{"href":"https://api.github.com/repos/edx/django-oauth2-provider/issues/9"},"comments":{"href":"https://api.github.com/repos/edx/django-oauth2-provider/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/django-oauth2-provider/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/django-oauth2-provider/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/django-oauth2-provider/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/edx/django-oauth2-provider/statuses/656aa922e9409ae7e7a6c406f568e78b62a34fc4"}}}}