{"action":"created","issue":{"url":"https://api.github.com/repos/sysgears/apollo-universal-starter-kit/issues/669","repository_url":"https://api.github.com/repos/sysgears/apollo-universal-starter-kit","labels_url":"https://api.github.com/repos/sysgears/apollo-universal-starter-kit/issues/669/labels{/name}","comments_url":"https://api.github.com/repos/sysgears/apollo-universal-starter-kit/issues/669/comments","events_url":"https://api.github.com/repos/sysgears/apollo-universal-starter-kit/issues/669/events","html_url":"https://github.com/sysgears/apollo-universal-starter-kit/issues/669","id":302726503,"number":669,"title":"API Specs with authentication","user":{"login":"theWeird","id":165980,"avatar_url":"https://avatars1.githubusercontent.com/u/165980?v=4","gravatar_id":"","url":"https://api.github.com/users/theWeird","html_url":"https://github.com/theWeird","followers_url":"https://api.github.com/users/theWeird/followers","following_url":"https://api.github.com/users/theWeird/following{/other_user}","gists_url":"https://api.github.com/users/theWeird/gists{/gist_id}","starred_url":"https://api.github.com/users/theWeird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theWeird/subscriptions","organizations_url":"https://api.github.com/users/theWeird/orgs","repos_url":"https://api.github.com/users/theWeird/repos","events_url":"https://api.github.com/users/theWeird/events{/privacy}","received_events_url":"https://api.github.com/users/theWeird/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-06T14:39:53Z","updated_at":"2018-03-07T12:16:56Z","closed_at":null,"author_association":"NONE","body":"For some server-specs it would be useful to have authentication before running the tests.\r\n\r\ne.g. to ensure a users profile can only be edited if the authenticated user is the same or at least an admin.\r\n\r\nMaybe you could add an example to serverside userspecs how to authenticate in before-part of a test suite to run tests with permissions of a specific user.\r\n\r\nI tried by adding these to a spec\r\n```javascript\r\n      const { data: { login } } = await apollo.mutate({\r\n        mutation: LOGIN,\r\n        variables: { input: { username: 'admin', password: 'admin' } },\r\n      });\r\n\r\n      await apollo.writeQuery({ query: CURRENT_USER_QUERY, data: { currentUser: login.user } });\r\n```\r\nBut still resolvers called by spec queries dont have a `context.user` object to check for authentication and authorization."},"comment":{"url":"https://api.github.com/repos/sysgears/apollo-universal-starter-kit/issues/comments/371120607","html_url":"https://github.com/sysgears/apollo-universal-starter-kit/issues/669#issuecomment-371120607","issue_url":"https://api.github.com/repos/sysgears/apollo-universal-starter-kit/issues/669","id":371120607,"user":{"login":"theWeird","id":165980,"avatar_url":"https://avatars1.githubusercontent.com/u/165980?v=4","gravatar_id":"","url":"https://api.github.com/users/theWeird","html_url":"https://github.com/theWeird","followers_url":"https://api.github.com/users/theWeird/followers","following_url":"https://api.github.com/users/theWeird/following{/other_user}","gists_url":"https://api.github.com/users/theWeird/gists{/gist_id}","starred_url":"https://api.github.com/users/theWeird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theWeird/subscriptions","organizations_url":"https://api.github.com/users/theWeird/orgs","repos_url":"https://api.github.com/users/theWeird/repos","events_url":"https://api.github.com/users/theWeird/events{/privacy}","received_events_url":"https://api.github.com/users/theWeird/received_events","type":"User","site_admin":false},"created_at":"2018-03-07T12:16:56Z","updated_at":"2018-03-07T12:16:56Z","author_association":"NONE","body":"I've seen it. But I already migrated auth from #522 into my app.\r\n\r\nAnyway.\r\nI assume to be able to use an authenticated session after login it is required to grab informations from response headers in BatchHttpLink afterware.\r\nJust found out, that the used versions of BatchHttpLink dont pass these in the context information to the afterware, so a newer version of apollo-link-http-batch is required. Unfortunatly the required version breaks with apollo-fetch, so it seems to be more to do than just to write a test ..."}}
{"actor":{"display_login":"theWeird"}}