How to add authorization in header by Glide in Android Studio?
This is working code for Glide v3/v4:
String url = "http://192.168.1.144/api/download/" + mImageIds.get(position);
GlideUrl glideUrl = new GlideUrl(url,
new LazyHeaders.Builder()
.addHeader("Cookie", AUTHORIZATION)
.addHeader("Accept", ABC)
.build());
Glide.with(this)
.load(glideUrl)
.into(imageView);
Kotlin
val url:String="https://URL.com/" + data[position].image_path;
val glideUrl = GlideUrl(
url,
LazyHeaders.Builder()
.addHeader("Authorization", "Bearer $token")
.build()
)
Glide.with(mContext)
.load(glideUrl)
.into(holder.binding.img);