To use the Reddit connector, add the <reddit.init>
element in your configuration before carrying out any other Reddit operations.
There are operations with authentication and without authentication.For Authentication, OAuth2 support allows you to use reddit to authenticate on non-reddit websites and applications.
API requests are made via HTTPS using your account's unique Reddit URL. Each request must be authenticated with a user's API authentication token using HTTP basic authentication. For more information, see https://github.com/reddit/reddit/wiki/OAuth2.
...
Go to https://www.reddit.com/ in your browser, and then click the HTTPS trust icon on the address bar (e.g., the padlock next to the URL in Chrome).
View the certificate details (the steps vary by browser) and then export the trust certificate to the file system.
Use the ESB Management Console or the following command to import that certificate into the ESB client keystore.
keytool -importcert -file CERT_FILE_NAME -keystore <ESB_HOME>/repository/resources/security/client-truststore.jks -alias "CERT_NAME"
NOTE : CERT_FILE_NAME - Replace CERT_FILE_NAME with the file name that was extracted from spotify reddit with the extension. (e.g. reddit.crt)
CERT_NAME - Replace CERT_NAME with an arbitrary name for the certificate. (e.g. reddit)
ESB should be configured as below.
Ensure that the following Axis2 configurations are added and enabled in the
<ESB_HOME>\repository\conf\axis2\axis2.xml
file.Required message formatters
Code Block title messageFormatters <messageFormatter contentType="text/html" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/> <messageFormatter contentType="text/plain" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
Required message builders
Code Block title messageBuilders <messageBuilder contentType="text/html" class="org.wso2.carbon.relay.BinaryRelayBuilder"/> <messageBuilder contentType="text/plain" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
Restart the server and deploy the Reddit configuration.
Code Block language xml title init <reddit.init> <apiUrlOauth>https://oauth.reddit.com</apiUrlOauth> <apiUrl>https://www.reddit.com</apiUrl> <apiVersion>v1</apiVersion> <accessToken>42591910-APa9HJeLE1jV2EjpIxigdTi79mw</accessToken> </reddit.init>
...