hi
I got the image url attached to the issue from the rest api.
http://xxx.xxx.xxx.xxx:xxxx/secure/attachment/10100/Image1.jpg
I am trying to view an image using Glide on android.
But it was not shown, so I checked it with a browser
The login screen appears.
Maybe it's an authentication problem.
I added the code to the header.
As follows
String url = "http://xxx.xxx.xxx.xxx:xxxx/secure/attachment/10100/Image1.jpg"
String userInfo = "userid:password";
String basicAuth = "Basic " + new String(Base64.encode(userInfo.getBytes(), userInfo.getBytes().length));
GlideUrl glideUrl = new GlideUrl(url,
new LazyHeaders.Builder()
.addHeader("Authorization", basicAuth)
.build());
Glide.with(this)
.load(glideUrl)
.into(imageview);
But I still get an error.
What should I do?
thank you.
Hello @smith ,
Welcome to the Atlassian Community!
If I understand correctly you are trying to download an attachment using REST API, but this is failing.
Now, if this is the case, I believe the root-cause is one of the following:
In order to double-check, please try to download the attachment using Curl (the -L option is to follow redirects, the -o to set the output filename):
curl -u <EMAIL-ADDRESS>:<API-TOKEN> -D- -L -X GET "https://xxxxxx.atlassian.net/secure/attachment/10010/Image1.jpg" -o filename.jpg
If this works then just update your code accordingly. If it does not work, please paste the output in your reply (removing sensitive data).
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.