Skip to content

Instantly share code, notes, and snippets.

@amanjeetsingh150
Created February 1, 2018 21:06
Show Gist options
  • Save amanjeetsingh150/047ef2dbce6203215df0a0c1bb84fff9 to your computer and use it in GitHub Desktop.
Save amanjeetsingh150/047ef2dbce6203215df0a0c1bb84fff9 to your computer and use it in GitHub Desktop.
private fun setupApollo(): ApolloClient {
val okHttp = OkHttpClient
.Builder()
.addInterceptor({ chain ->
val original = chain.request()
val builder = original.newBuilder().method(original.method(),
original.body())
builder.addHeader("Authorization"
, "Bearer " + BuildConfig.AUTH_TOKEN)
chain.proceed(builder.build())
})
.build()
return ApolloClient.builder()
.serverUrl(BASE_URL)
.okHttpClient(okHttp)
.build()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment