Why am I getting a 404 here, while downloading a private repo release artifact.
URL url = new URL("https://github.com/anandchakru/private_repo/releases/download/rel_v1/artif-3.0.jar?access_token=myaccesstoken");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
System.out.println(connection.getResponseCode()); //404
and not here, while downloading a public repo release artifact?
URL url = new URL("https://github.com/anandchakru/fr/releases/download/1.0/fr.jar");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
System.out.println(connection.getResponseCode()); //200
Note: I'm able to download https://github.com/anandchakru/private_repo/releases/download/rel_v1/artif-3.0.jar?access_token=myaccesstoken
(in an incognito/provate_mode browser).
Ended doing the following:
Accept: application/json
https://api.github.com/repos/anandchakru/private_repo/releases/assets/<asset_id>?access_token=myaccesstoken
to fetch the artifact.Code:
Don't forget to close the foStream & uChannel.