Back to project page kluster-android.
The source code is released under:
Apache License
If you think the Android project kluster-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.cs446.kluster.net; /*from w w w. j a va 2s . c om*/ import android.content.Context; import android.content.SharedPreferences; import com.cs446.kluster.KlusterApplication; import retrofit.RequestInterceptor; public class AuthInterceptor implements RequestInterceptor { public AuthInterceptor() { } @Override public void intercept(RequestFacade request) { SharedPreferences pref = KlusterApplication.getInstance().getContext().getSharedPreferences("User", Context.MODE_PRIVATE); String token = pref.getString("token", ""); request.addHeader("Authorization", "Bearer " + token); } }