Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

...

  1. View the certificate details (the steps vary by browser) and then export the trust certificate to the file system.

  2. 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 with the extension. (e.g. reddit.crt)

                   CERT_NAME - Replace CERT_NAME with an arbitrary name for the certificate. (e.g. reddit)

  3. 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
    titlemessageFormatters
    <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
    titlemessageBuilders
    <messageBuilder contentType="text/html" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
    <messageBuilder contentType="text/plain" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
  4. Restart the server and deploy the Reddit configuration.

    Code Block
    languagexml
    titleinit
    <reddit.init>
    	<apiUrlOauth>{$ctx:apiUrlOauth}<<apiUrlOauth>https://oauth.reddit.com</apiUrlOauth>
    	<apiUrl>{$ctx:apiUrl}<<apiUrl>https://www.reddit.com</apiUrl>
    	<apiVersion>{$ctx:apiVersion}<<apiVersion>v1</apiVersion>
    	<accessToken>{$ctx:accessToken}<<accessToken>42591910-APa9HJeLE1jV2EjpIxigdTi79mw</accessToken>
    </reddit.init>

...