{"action":"opened","issue":{"url":"https://api.github.com/repos/apollographql/react-apollo/issues/2167","repository_url":"https://api.github.com/repos/apollographql/react-apollo","labels_url":"https://api.github.com/repos/apollographql/react-apollo/issues/2167/labels{/name}","comments_url":"https://api.github.com/repos/apollographql/react-apollo/issues/2167/comments","events_url":"https://api.github.com/repos/apollographql/react-apollo/issues/2167/events","html_url":"https://github.com/apollographql/react-apollo/issues/2167","id":338950203,"node_id":"MDU6SXNzdWUzMzg5NTAyMDM=","number":2167,"title":"General: Update Apollo Client object on runtime","user":{"login":"metpb","id":7520672,"node_id":"MDQ6VXNlcjc1MjA2NzI=","avatar_url":"https://avatars0.githubusercontent.com/u/7520672?v=4","gravatar_id":"","url":"https://api.github.com/users/metpb","html_url":"https://github.com/metpb","followers_url":"https://api.github.com/users/metpb/followers","following_url":"https://api.github.com/users/metpb/following{/other_user}","gists_url":"https://api.github.com/users/metpb/gists{/gist_id}","starred_url":"https://api.github.com/users/metpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metpb/subscriptions","organizations_url":"https://api.github.com/users/metpb/orgs","repos_url":"https://api.github.com/users/metpb/repos","events_url":"https://api.github.com/users/metpb/events{/privacy}","received_events_url":"https://api.github.com/users/metpb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-06T13:59:24Z","updated_at":"2018-07-06T13:59:24Z","closed_at":null,"author_association":"NONE","body":"I am working on a project where I am using a Rest API for data (token) to be passed on to the GraphQL API later after authentication. \r\nThe whole app is wrapped in an ApolloProvider object like the example below. \r\n\r\n```\r\nconst Client = new ApolloClient({\r\n    link: new HttpLink({\r\n        uri: [Broker Address],\r\n        headers: {\r\n            authorization: `[Bearer token to be retrieved using a Rest API]`,\r\n         }\r\n    }),\r\n    cache: memoryCache\r\n})\r\n```\r\n\r\n```\r\n<ApolloProvider client={Client}>\r\n    <AppNavigator />      \r\n</ApolloProvider>\r\n```\r\n\r\nBut since I am retrieving the graphql token after authentication from the Rest API, I won't be able to pass the data at initialisation.\r\n\r\nThe obvious (i might be wrong since I am really new to JS and RN) alternative is to have two separate navigators (one for the Rest auth flow, and the other for the GraphQL flow) and only to wrap the GraphQL based navigator with ApolloProvider.\r\n\r\nBut just wanted to check if there is a way to dynamically update the `HttpLink` or the `ApolloClient` object on the `ApolloProvider` wrapper later during runtime?\r\n\r\n[Not sure if this a relevant question to be posted here as an issue, but did it anyway since the `react-apollo` community on StackOverflow is relatively small. Appreciate your understanding. Thanks!]\r\n\r\n<!--**Issue Labels**\r\n\r\nWhile not necessary, you can help organize our issues by labeling this issue when you open it.  To add a label automatically, simply [x] mark the appropriate box below:\r\n\r\n- [ ] has-reproduction\r\n- [x] feature\r\n- [ ] docs\r\n- [ ] blocking\r\n- [ ] good first issue\r\n\r\nTo add a label not listed above, simply place `/label another-label-name` on a line by itself.\r\n-->"}}
{"actor":{"display_login":"metpb"}}