{"action":"created","issue":{"url":"https://api.github.com/repos/graphile/postgraphile/issues/910","repository_url":"https://api.github.com/repos/graphile/postgraphile","labels_url":"https://api.github.com/repos/graphile/postgraphile/issues/910/labels{/name}","comments_url":"https://api.github.com/repos/graphile/postgraphile/issues/910/comments","events_url":"https://api.github.com/repos/graphile/postgraphile/issues/910/events","html_url":"https://github.com/graphile/postgraphile/pull/910","id":381613661,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxNTQxMTg2","number":910,"title":"Provide jwtClaims in resolver context when set via pgSettings","user":{"login":"RomanGotsiy","id":3975738,"node_id":"MDQ6VXNlcjM5NzU3Mzg=","avatar_url":"https://avatars0.githubusercontent.com/u/3975738?v=4","gravatar_id":"","url":"https://api.github.com/users/RomanGotsiy","html_url":"https://github.com/RomanGotsiy","followers_url":"https://api.github.com/users/RomanGotsiy/followers","following_url":"https://api.github.com/users/RomanGotsiy/following{/other_user}","gists_url":"https://api.github.com/users/RomanGotsiy/gists{/gist_id}","starred_url":"https://api.github.com/users/RomanGotsiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RomanGotsiy/subscriptions","organizations_url":"https://api.github.com/users/RomanGotsiy/orgs","repos_url":"https://api.github.com/users/RomanGotsiy/repos","events_url":"https://api.github.com/users/RomanGotsiy/events{/privacy}","received_events_url":"https://api.github.com/users/RomanGotsiy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-16T14:07:47Z","updated_at":"2018-11-16T14:59:47Z","closed_at":"2018-11-16T14:30:59Z","author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/graphile/postgraphile/pulls/910","html_url":"https://github.com/graphile/postgraphile/pull/910","diff_url":"https://github.com/graphile/postgraphile/pull/910.diff","patch_url":"https://github.com/graphile/postgraphile/pull/910.patch"},"body":"If JWT token is parsed/validated via `pgSettings`, jwtClaims are not passed to the custom resolver context.\r\n\r\n```js\r\nmakeExtendSchemaPlugin(\r\n  build => ({\r\n    typeDefs: gql`\r\n      extend type Thing {\r\n        isOwner: Boolean! @requires(columns: [\"owner\"])\r\n      }\r\n    `,\r\n    resolvers: {\r\n      Thing: {\r\n        isOwner: async (row, _args, context) => {\r\n          return row.owner === context.jwtClaims.user_id; // <-- // context.jwtClaims is null here\r\n        }\r\n      }\r\n    }\r\n  })\r\n)\r\n```\r\n\r\nThis PR fixes it."},"comment":{"url":"https://api.github.com/repos/graphile/postgraphile/issues/comments/439419378","html_url":"https://github.com/graphile/postgraphile/pull/910#issuecomment-439419378","issue_url":"https://api.github.com/repos/graphile/postgraphile/issues/910","id":439419378,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTQxOTM3OA==","user":{"login":"RomanGotsiy","id":3975738,"node_id":"MDQ6VXNlcjM5NzU3Mzg=","avatar_url":"https://avatars0.githubusercontent.com/u/3975738?v=4","gravatar_id":"","url":"https://api.github.com/users/RomanGotsiy","html_url":"https://github.com/RomanGotsiy","followers_url":"https://api.github.com/users/RomanGotsiy/followers","following_url":"https://api.github.com/users/RomanGotsiy/following{/other_user}","gists_url":"https://api.github.com/users/RomanGotsiy/gists{/gist_id}","starred_url":"https://api.github.com/users/RomanGotsiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RomanGotsiy/subscriptions","organizations_url":"https://api.github.com/users/RomanGotsiy/orgs","repos_url":"https://api.github.com/users/RomanGotsiy/repos","events_url":"https://api.github.com/users/RomanGotsiy/events{/privacy}","received_events_url":"https://api.github.com/users/RomanGotsiy/received_events","type":"User","site_admin":false},"created_at":"2018-11-16T14:59:47Z","updated_at":"2018-11-16T14:59:47Z","author_association":"NONE","body":"Ah. Missed that function.\r\nThis way I have to parse JWT token twice.\r\n\r\nBut this is not an issue for my use case as I am using this primarily for testing.\r\n\r\nThanks for the quick reply!"}}
{"actor":{"display_login":"RomanGotsiy"}}