Simple code that demonstrates how to authenticate against adobe.io using Java. Read the blog article explaining this.
There is some setup that you have to do.
- Create a "secret.key" file based on the private/public key you made for the Adobe.io integration
- Copy values from the Adobe.io Console
- Copy a property ID from the Launch UI
- Decide whether you want to spy on traffic using Charles or another proxy
- See notes on Debugging further down
- Run
You can use Charles (or another proxy) to debug traffic between the app and Adobe IO.
Make sure you set the PROXY_HOST
and PROXY_PORT
constants correctly. The actual choice of using a proxy or not happens when you create the httpClient
on line 74 of the AppTest
class. Just use the HttpClientBuilder of your choice.
I am using the Launch API to check whether my access works.
If you want to use any other API, you need to change metaContexts
, apiHostFQDN
, and apiEndpoint
, accordingly.
Code quality: this is the most appalling spaghetti-code I have written in a long time. This was deliberate. I want to show exactly which steps need to be taken in what order.
Feel free to refactor to your standards.