Skip to content

Instantly share code, notes, and snippets.


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 /
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.
private class HttpInterceptor implements Interceptor {
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.