This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

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.

Reddit connector uses Authorization Code Flow.

Note

When you try to get the code for the created secret app please use scope as following

"scope=identity,edit,flair,history,mysubreddits,privatemessages,read,report,save,submit,subscribe,vote,wikiedit,wikiread"

because, then only you can get that created app as authorized applications with that defined scope.

You can follow the following steps to import your Reddit certificate into wso2esb client’s keystore as follows:

  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
    messageFormatters
    <messageFormatter contentType="text/html" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
    <messageFormatter contentType="text/plain" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
    Required message builders
    messageBuilders
    <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.

    init
    <reddit.init>
    	<apiUrlOauth>{$ctx:apiUrlOauth}</apiUrlOauth>
    	<apiUrl>{$ctx:apiUrl}</apiUrl>
    	<apiVersion>{$ctx:apiVersion}</apiVersion>
    	<accessToken>{$ctx:accessToken}</accessToken>
    </reddit.init>
Properties
  • apiUrlOauth : URL of the Reddit API for oauth scope methods.

  • apiUrl : URL of the Reddit API.

  • apiVersion:  Version of the API.

  • accessToken : Use Refresh token to get access token.

Now you have connected to Reddit, use the information in the following resources to perform the operations with the connector. After you have completed the configurations, go through Testing the Reddit Rest Integration to test those operations.

  • No labels