MΓ³dulo 08 Β· Auth & Secure Storage β LecciΓ³n 3 de 4 Β· ~8 min
Attaching It Automatically
Nobody should have to remember the header
If every screen that calls the API had to remember to read the token and stick it on the request, sooner or later one would forget β and ship a silent bug. PawWalk solves this once, centrally, with an OkHttp interceptor: a function that gets a look at every outgoing request before it leaves the device, and can modify it on the way out.
You met Network.kt's overall shape in the last module. Here's the piece we skipped: the authInterceptor sitting right above the OkHttpClient.