Paul Weber
12/22/2021, 12:50 PMHttpClient
that I instantiate at startup and hand over to all my remote data source classes via Koin. So basically a singleton.
1. Is that the best practice or should I create a client for every request? Or something else?
With that approach I’m running into the problem of not being able to “logout” so to speak.
As in: the bearerAuth.loadTokens
gets called once on creation instead of on every web request.
2. How can I remove the bearer token from the HttpClient
, so that it knows to loadTokens
once again?
3. If my approach with just one HttpClient
at the same time is valid and it’s not possible to remove the tokens, would it be proper to just create a new HttpClient
on every logout? It would certainly be the easy way out, but is there something better?Rustam Siniukov
12/22/2021, 3:24 PMclient.plugin(Auth)!!.providers.filterIsInstance<BearerAuthProvider>().first().clearToken()
Paul Weber
12/22/2021, 3:40 PM.plugin
declared? I can’t find it on my HttpClient
1.6.7
Rustam Siniukov
12/22/2021, 3:56 PMclient[Auth]
syntaxPaul Weber
12/22/2021, 3:58 PM