: jwt가 있으면 Header에 자동으로 X-ACCESS-TOKEN을 추가

class XAccessTokenInterceptor : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val builder: Request.Builder = chain.request().newBuilder()

        val jwtToken: String? = getJwt() 

            jwtToken?.let {
                builder.addHeader(X_ACCESS_TOKEN, jwtToken)
            }

        return chain.proceed(builder.build())
    }
}

: retrofit, spf 기본 세팅을 도와줌

class GlobalApplication: Application() {
    companion object{
        const val X_ACCESS_TOKEN: String = "X-ACCESS-TOKEN"  // JWT Token Key
        const val TAG: String = "FOOTPRINT-APP"              // SharedPreference
        const val BASE_URL: String = BASE_URL

        lateinit var retrofit: Retrofit
        lateinit var mSharedPreferences: SharedPreferences
    }

    override fun onCreate() {
        super.onCreate()
    
        val client: OkHttpClient = OkHttpClient.Builder()
            .readTimeout(30000, TimeUnit.MILLISECONDS)
            .connectTimeout(30000, TimeUnit.MILLISECONDS)
            .addNetworkInterceptor(XAccessTokenInterceptor()) // JWT 자동 헤더 전송
            .build()

        retrofit = Retrofit.Builder()
            .baseUrl(BASE_URL)
            .client(client)
            .addConverterFactory(GsonConverterFactory.create())
            .build()

        mSharedPreferences = applicationContext.getSharedPreferences(TAG, Context.MODE_PRIVATE)
    }
}

[참고] https://velog.io/@prayme/Retrofit2로-JWT-인증하기