Class RefreshAndRetryInterceptor

  • All Implemented Interfaces:
    okhttp3.Interceptor

    public class RefreshAndRetryInterceptor
    extends java.lang.Object
    implements okhttp3.Interceptor
    Interceptor for automatic Access Token Refresh via Sdk. A request passes through the following pipeline during Expired Token scenarios:
    1. Stops the thread of the current request, and all the succeeding requests
    2. Refresh the token via the current request thread
    3. After refreshing the token, notify all the stopped threads to continue
    4. Rewrite the original request object w/ the newly refreshed token

    Checks for error code 4002: Expired token

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface okhttp3.Interceptor

        okhttp3.Interceptor.Chain, okhttp3.Interceptor.Companion
    • Field Summary

      • Fields inherited from interface okhttp3.Interceptor

        Companion
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      okhttp3.Response intercept​(okhttp3.Interceptor.Chain chain)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RefreshAndRetryInterceptor

        public RefreshAndRetryInterceptor​(android.content.Context context)
    • Method Detail

      • intercept

        public okhttp3.Response intercept​(okhttp3.Interceptor.Chain chain)
                                   throws java.io.IOException
        Specified by:
        intercept in interface okhttp3.Interceptor
        Throws:
        java.io.IOException