Skip to content

Instantly share code, notes, and snippets.

Avatar

Akshay sharma akshay2211

View GitHub Profile
View Oauth Authenticator
/**
* Created by akshay on 28/8/17.
*/
public class TokenAuthenticator implements Authenticator {
private final Context c;
public TokenAuthenticator(Context c) {
this.c = c;
}
@alex-shpak
alex-shpak / Interceptor.java
Last active Sep 22, 2020
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
View Interceptor.java
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON
You can’t perform that action at this time.