{"action":"created","issue":{"url":"https://api.github.com/repos/uc-cdis/fence/issues/598","repository_url":"https://api.github.com/repos/uc-cdis/fence","labels_url":"https://api.github.com/repos/uc-cdis/fence/issues/598/labels{/name}","comments_url":"https://api.github.com/repos/uc-cdis/fence/issues/598/comments","events_url":"https://api.github.com/repos/uc-cdis/fence/issues/598/events","html_url":"https://github.com/uc-cdis/fence/issues/598","id":426022019,"node_id":"MDU6SXNzdWU0MjYwMjIwMTk=","number":598,"title":"Support `email` scope in authentication flow","user":{"login":"VJalili","id":9027482,"node_id":"MDQ6VXNlcjkwMjc0ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/9027482?v=4","gravatar_id":"","url":"https://api.github.com/users/VJalili","html_url":"https://github.com/VJalili","followers_url":"https://api.github.com/users/VJalili/followers","following_url":"https://api.github.com/users/VJalili/following{/other_user}","gists_url":"https://api.github.com/users/VJalili/gists{/gist_id}","starred_url":"https://api.github.com/users/VJalili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VJalili/subscriptions","organizations_url":"https://api.github.com/users/VJalili/orgs","repos_url":"https://api.github.com/users/VJalili/repos","events_url":"https://api.github.com/users/VJalili/events{/privacy}","received_events_url":"https://api.github.com/users/VJalili/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-03-27T15:18:17Z","updated_at":"2019-03-27T15:35:33Z","closed_at":null,"author_association":"NONE","body":"When I set scopes in my authentication request to `['openid', 'user']`, I get an ID token whose `context` decodes as:\r\n\r\n```\r\n  \"context\": {\r\n    \"user\": {\r\n      \"phone_number\": null,\r\n      \"display_name\": null,\r\n      \"name\": \"xyz@gmail.com\",\r\n      \"is_admin\": false,\r\n      \"policies\": [],\r\n      \"email\": null,\r\n      \"projects\": {}\r\n    }\r\n  },\r\n```\r\n\r\nwhere `name` filed contains the email address, and the `email` field is `null`. \r\n\r\nI changed the scope to `['openid', 'user', 'email']`, but then I get the `Unauthorized` exception:\r\n\r\nhttps://github.com/uc-cdis/fence/blob/31744be49ec0a56492d6a87a110c5af699f87189/fence/auth.py#L98-L104\r\n\r\nbecause `email` is not a currently supported scope:\r\n\r\nhttps://github.com/uc-cdis/fence/blob/8337488620fad4ea32160d537e73c825cd93d18d/fence/jwt/token.py#L50-L56\r\n\r\nI was wondering if can add a support for the `email` scope so a future `context` would decode as: \r\n\r\n```\r\n  \"context\": {\r\n    \"user\": {\r\n      \"phone_number\": null,\r\n      \"display_name\": null,\r\n      \"name\": \"xyz\",\r\n      \"is_admin\": false,\r\n      \"policies\": [],\r\n      \"email\": \"xyz@gmail.com\",\r\n      \"projects\": {}\r\n    }\r\n  },\r\n```"},"comment":{"url":"https://api.github.com/repos/uc-cdis/fence/issues/comments/477213112","html_url":"https://github.com/uc-cdis/fence/issues/598#issuecomment-477213112","issue_url":"https://api.github.com/repos/uc-cdis/fence/issues/598","id":477213112,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3NzIxMzExMg==","user":{"login":"Avantol13","id":9382451,"node_id":"MDQ6VXNlcjkzODI0NTE=","avatar_url":"https://avatars0.githubusercontent.com/u/9382451?v=4","gravatar_id":"","url":"https://api.github.com/users/Avantol13","html_url":"https://github.com/Avantol13","followers_url":"https://api.github.com/users/Avantol13/followers","following_url":"https://api.github.com/users/Avantol13/following{/other_user}","gists_url":"https://api.github.com/users/Avantol13/gists{/gist_id}","starred_url":"https://api.github.com/users/Avantol13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Avantol13/subscriptions","organizations_url":"https://api.github.com/users/Avantol13/orgs","repos_url":"https://api.github.com/users/Avantol13/repos","events_url":"https://api.github.com/users/Avantol13/events{/privacy}","received_events_url":"https://api.github.com/users/Avantol13/received_events","type":"User","site_admin":false},"created_at":"2019-03-27T15:35:33Z","updated_at":"2019-03-27T15:35:33Z","author_association":"CONTRIBUTOR","body":"we could additionally support the `email` field as the OIDC spec defines, but then the `email` field would end up outside the `context` block, per the spec. Furher conformance to the optional features in OIDC are something we are continuing to pursue as well"}}
{"actor":{"display_login":"Avantol13"}}