How to add Api_KEY into interceptor using okhttp
问题 I have this service where I want to put the token as an interception in the okhttp instead of passing as a parameter with @Header("MY_API_KEY") This is my code regarding the service /** * Provides the [PHService] */ fun provideService(): PHService { val logger = HttpLoggingInterceptor() logger.level = HttpLoggingInterceptor.Level.BASIC val client = OkHttpClient.Builder() .addInterceptor(logger) .build() return Retrofit.Builder() .baseUrl(BuildConfig.API_URL) .client(client)