I have an Interceptor to send my authToken to the API for the verifying but I need to send the token when I load the image from the API too but I have no clue I already try everything but nothing works. Can I connect my Interceptor with my Glide?
Asked
Active
Viewed 532 times
-1
-
Does this answer your question? [How to add authorization in header by Glide in Android Studio?](https://stackoverflow.com/questions/51149546/how-to-add-authorization-in-header-by-glide-in-android-studio) – ADM Feb 27 '21 at 09:23
-
`RetroFit` and `Glide` has nothing to do with each other . they r two different libraries. – ADM Feb 27 '21 at 09:24
-
Where I have to write the code ? In AppGlidemodule ? or before in the Adapter class where I call Glide? – Sir_Flatcher Feb 28 '21 at 16:26
1 Answers
0
this is my Adapter,
override fun onBindViewHolder(holder: CountryItem, position: Int) {
holder.bind(getItem(position))
val currentItem = getItem(position)
holder.apply {
token = sessionManager.fetchAuthToken().toString()
val url=(getItem(position)).image?.url
val glideUrl = GlideUrl(
url,
LazyHeaders.Builder()
.addHeader( "X-FIREBASE-TOKEN", token)
.build()
)
Glide.with(itemView)
.load(currentItem.image?.url)
.into(itemView.post_image)
com.bumptech.glide.load.HttpException(Unauthorized, status code: 401) call GlideException#logRootCauses(String) for more detail Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE

Sir_Flatcher
- 1
- 2