Created
July 13, 2019 16:48
-
-
Save harmittaa/781a509dd066142979d04d446bde3e4d to your computer and use it in GitHub Desktop.
Koin 2.0 and Retrofit 2.6.0 example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import okhttp3.Interceptor | |
import okhttp3.Response | |
class AuthInterceptor() : Interceptor { | |
override fun intercept(chain: Interceptor.Chain): Response { | |
var req = chain.request() | |
// DONT INCLUDE API KEYS IN YOUR SOURCE CODE | |
val url = req.url().newBuilder().addQueryParameter("APPID", "your_key_here").build() | |
req = req.newBuilder().url(url).build() | |
return chain.proceed(req) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment