Hey @gabriel , I have managed to successfully connect to Infura IPFS using one of the examples in the stack overflow link I shared in my earlier reply. Java is not my strongest point, but please see the below code snippet example for an HttpBasicAuth class:
Hey. let’s try to troubleshoot this within a support ticket. Please raise one here Contact Us | Infura, by selecting Customer Support from the dropdown, also please specify the email associated with your Infura account.
QmYt9ypyGsR1BKdaCGPdwdBgAiuXK5AYN2bGSNZov7YXuk is the Content Identifier (CID) of an object stored in IPFS.
I can send you some introductory material on IPFS and how you can make use of of your Infura IPFS project.
Hey @gabriel , all requests sent to the Infura Ipfs api need to be authenticated, but in order to upload a file you will need to use the POST method. By using GET you will receive a 405 method not allowed error, as get is not supported.
So basically in the same call you could authenticate your project and upload a file.
But a 401 error code means that you are not passing the authentication header correctly. Have you tried the code example I shared and just replacing the Project ID and Project Secret with yours?
Do you have access to a Mac or linux terminal? let’s try to generate the base64 string manually with the following command: echo -n "myProjectId:myKeySecret" | base64 -w 0 echo -n "27hXXX7LRsj:205XXX15b" | base64 -w 0
The resulting string would look like the below and let’s pass that one directly in the basic auth, without declaring the values string.
you can use the Chrome developers console to get the base64 encoded string in windows.
navigate to the developers tools console and type btoa("myProjectId:myKeySecret"), the result will be the string you need:
Hi Gabriel, happy that you managed to connect.
I am not fluent in java, but now that you have managed to open the connection using your Infura IPFS credentials, I think that you should be able to use the tutorial you were following to continue defining your IPFS java client and use its methods to upload files or folders to IPFS and get their CIDs. My guess is that the IPFS java client should have an add file method which you could use.
I can share some documentation which can maybe get you up to speed with IPFS.