Handle session expirations and 401 error codes. The following code will be activated if the API responds with a 401 (no authentication). If there’s a token that should be renewed, we first renew the token and if this is successful we try the original request again.
Read more…All snippets tagged with retrofit
Page 1 of 1Okhttp 401 handler
Using local JSON files as an API placeholder with Retrofit
With this snippet you can easily and quickly mock an API during developmentby placing JSON files in your res/raw/
folder. This comes in handy when the actual
API does not exist yet.
Centralized error handling
Global error handling for REST requests.
Read more…