{"action":"opened","issue":{"url":"https://api.github.com/repos/facebook/relay/issues/858","repository_url":"https://api.github.com/repos/facebook/relay","labels_url":"https://api.github.com/repos/facebook/relay/issues/858/labels{/name}","comments_url":"https://api.github.com/repos/facebook/relay/issues/858/comments","events_url":"https://api.github.com/repos/facebook/relay/issues/858/events","html_url":"https://github.com/facebook/relay/issues/858","id":135091599,"number":858,"title":"forceFetch without using node","user":{"login":"legomind","id":3710857,"avatar_url":"https://avatars.githubusercontent.com/u/3710857?v=3","gravatar_id":"","url":"https://api.github.com/users/legomind","html_url":"https://github.com/legomind","followers_url":"https://api.github.com/users/legomind/followers","following_url":"https://api.github.com/users/legomind/following{/other_user}","gists_url":"https://api.github.com/users/legomind/gists{/gist_id}","starred_url":"https://api.github.com/users/legomind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/legomind/subscriptions","organizations_url":"https://api.github.com/users/legomind/orgs","repos_url":"https://api.github.com/users/legomind/repos","events_url":"https://api.github.com/users/legomind/events{/privacy}","received_events_url":"https://api.github.com/users/legomind/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-20T16:19:16Z","updated_at":"2016-02-20T16:19:16Z","closed_at":null,"body":"I have an app that uses Hawk for authentication ([hueniverse/hawk](https://github.com/hueniverse/hawk))\r\n\r\nThe authentication is driven using a plain http endpoint `/api/auth`\r\n\r\nMy graphQL endpoint has the following relay compatible schema:\r\n\r\n```js\r\nconst QueryType = new GraphQLObjectType({\r\n  name: 'Query',\r\n  fields: () => ({\r\n    node: nodeField,\r\n\r\n    viewer: {\r\n      type: UserType,\r\n      resolve ({ auth }) { //root param is the http request object\r\n        return auth.isAuthenticated\r\n          ? User.GetById(auth.credentials.authKey.ownerId)\r\n          : null\r\n      },\r\n    },\r\n...\r\n}\r\n```\r\n\r\nSo when an unauthenticated user first visits the site, the following query is run:\r\n```graphQL\r\nquery Client {\r\n  viewer {\r\n    ...F3,\r\n    id\r\n  }\r\n}\r\n\r\nfragment F0 on User {\r\n  firstName,\r\n  id,\r\n  lastName\r\n}\r\n\r\nfragment F1 on User {\r\n  id,\r\n  permissions\r\n}\r\n\r\nfragment F2 on User {\r\n  ...F0,\r\n  ...F1,\r\n  id\r\n}\r\n\r\nfragment F3 on User {\r\n  ...F2,\r\n  id\r\n}\r\n```\r\n\r\nSince this query is lacking Hawk credentials in the http headers, the above query returns null, causing the app to render a login form.\r\n\r\nUpon login, the app will make a call to `/auth` in order to get credentials for future graphQL calls\r\n\r\nThen the login page will call `this.props.relay.forceFetch()` in order to update the required user data.\r\n\r\nHowever, since the initial call returns `null` relay simply skips and graphQL calls because it does not have an id to send to query `node` with.\r\n\r\nIf I refresh the entire page, the `viewer` prop contains the user data of the logged in user, and if I login again, the following query runs:\r\n\r\n```graphQL\r\nquery LoginPage_ViewerRelayQL($id_0:ID!) {\r\n  node(id:$id_0) {\r\n    ...F2,\r\n    __typename,\r\n    id\r\n  }\r\n}\r\n\r\nfragment F0 on User {\r\n  firstName,\r\n  id,\r\n  lastName\r\n}\r\n\r\nfragment F1 on User {\r\n  id,\r\n  permissions\r\n}\r\n\r\nfragment F2 on User {\r\n  ...F0,\r\n  ...F1,\r\n  id\r\n}\r\n```\r\n\r\nHow can I force relay to use the inital query to refetch the currently logged in user?\r\n\r\n\r\n"}}