Linked Questions
23 questions linked to/from Refreshing OAuth token using Retrofit without modifying all calls
19
votes
3answers
7k views
How to resolve a circular dependency while still using Dagger2?
I have two classes, Foo<T> and Bar, which depend on each other, as well as various other classes. I am using Dagger-2 for dependency injection, but if I naively add the circular dependency, ...
24
votes
2answers
24k views
Android Retrofit 2.0 Refresh Tokens
I am using Retrofit 2.0 with Jackson converter for communication with a Rest API. Some of the requests require tokens on authorization. If the tokens that I have are out-of-date, I need to refresh ...
18
votes
4answers
6k views
Android Dagger2 + OkHttp + Retrofit dependency cycle error
Hey there I am using Dagger2, Retrofit and OkHttp and I am facing dependency cycle issue.
When providing OkHttp :
@Provides
@ApplicationScope
OkHttpClient provideOkHttpClient(TokenAuthenticator ...
6
votes
3answers
17k views
Android - Retrofit 2 - Authenticator Result
I'm trying to use Retrofit (2.0.0-beta3), but when using an Authenticator to add a token, I can't seem to get the data from the synchronous call. Our logging on the back-end just shows a lot of login ...
12
votes
2answers
11k views
Good approach to manually retry requests in Retrofit Android
I understand retrofit automatically retries on failures, but I want to check for a specific error. If the error is due to a certain HTTP code, I need to retry that request after modifying it.
This ...
5
votes
3answers
7k views
Okhttp NoClassDefFoundError
I am using OkHttp 2.0.0 jar in my android application on eclipse. As OkHttp is now dependent on Okio library, I also added Okio 1.0.0 jar in my project.The project compiles fine with no compilation ...
2
votes
1answer
7k views
Check if access token expired
I have an api that returns this after authentication
"token_type":"Bearer",
"expires_in":86400,
"access_token":"XXXXXXXXX",
"refresh_token":"XXXXXXXXXXX"
I have successfully saved the access token, ...
1
vote
1answer
2k views
Why retrofit Authenticator is not called?
I want to change response from server to 423 -> 401, and then call refreshToken by using Authenticator.
The method is called if response code is 401
But why the method Authenticator.authenticate(...
4
votes
3answers
2k views
How to avoid waiting on main thread when adding headers to requests using retrofit?
I use this to config my retrofit:
RestAdapter restAdapter = new RestAdapter.Builder()
//add headers to requests
.setRequestInterceptor(getAuthenticatedRequestInterceptor())
...
9
votes
2answers
3k views
OkHttp and Retrofit, refresh token with concurrent requests
In my application I implemented Retrofit to call WebServices and I'm using OkHttp to use Interceptor and Authenticator. Some requests need token, and I have implemented Authenticator interface to ...
-1
votes
2answers
2k views
What is the best practices for retry mechanism while using Retrofit?
Problem Statement:
I'm using Retrofit in my application for API calls. Currently I've 20+ Retrofit Interfaces, with different Callbacks. Currently when app receives INVALID_SESSION_ID in anyone of ...
6
votes
1answer
2k views
Handling specific errors by sending another request transparently in retrofit
Here's the case I'm trying to handle,
If a request is executed, and the response indicates the auth token is expired,
send a refresh token request
if the refresh token request succeeds, retry the ...
4
votes
2answers
3k views
Handle Background Refresh token call in Retrofit parallel network calls
I am new to android programming and Retrofit , I am making a sample app where i have to make two parallel network calls using access token.
The problem comes when access token is expired and return ...
0
votes
2answers
1k views
How to refresh token after particular time?
I am working in an application in which I need to refresh my token after every 60 minutes. I have created a service which runs in the background. However, the problem I am facing is, when the phone ...
2
votes
1answer
1k views
OKHttp Authenticator custom http code other than 401 and 407
I have oauth token implemented on server side but upon Invalid token or Token expirey i am getting 200 http status code but in response body i have
{"code":"4XX", "data":{"some":"object"}
When i try ...