Jive Apps Command Line Tools - OAuth Services

Version 1

    On Friday, the Jive Apps CLI Tools were updated to version 0.0.9. This major new feature in this version is OAuth Services. You can now register third party OAuth services with the Jive Apps Gateway via the command line.

     

    All app-specific commands can now be run from within an app's directory - so you no longer need to type the app name for each command:

     

    $ cd foo_bar_app

     

    $ jiveapps info

    === foo_bar_app

    Git URL:               git@apphosting.jivesoftware.com:foo_bar_app.git

    App URL:               http://apphosting.jivesoftware.com/apps/foo_bar_app/app.xml

    Sandbox Canvas URL:    https://app-sandbox.jivesoftware.com/apps/foo_bar_app/

    Sandbox Dashboard URL: https://app-sandbox.jivesoftware.com/apps/dashboards/default-dashboard

    OAuth Consumer Key:    fake2345u8xuxahsdfkjahsdf8234823

    OAuth Consumer Secret: fakeKJHKJHFABFBF78gbcbKJHKGD

     

    If you are outside an app's directory, you can specify the app with "--app <appname>"

     

    $ jiveapps info --app foo_bar_app

     

    OAuth Services

     

    Run "jiveapps info" to list any oauth services associated with an app, along with all other app metadata. Or run "jiveapps oauth" to list the services for this app, without the other app metadata:

     

    $ cd foo_bar_app

     

    $ jiveapps oauth

    No OAuth Services for foo_bar_app

     

    No OAuth services are currently defined.

     

    Twitter Example

     

    For the app "foo_bar_app", I plan to integrate with Twitter, so I'll setup a Twitter OAuth service. First, go to the Twitter developer site and create a new application.

     

    1. Go to dev.twitter.com/apps

    2. Login and click "Register new app"

    3. Enter in your application's title, description, website and organization name.

    4. Select "Browser" as the app type.

    5. Set the callback URL to "http://gateway.jivesoftware.com/gateway/oauth/callback"

    6. Choose "Read & Write" so your app may update a user's twitter status.

    7. Finish filling out the form and register the app.

    8. Once your app has been registered, Twitter will display your OAuth 1.0a Settings.

     

    oa1.png

     

    Note the consumer key and secret, and register a new oauth service on the command line:

     

    $ jiveapps oauth:add twitter your_consumer_key your_consumer_secret

    === Registering a new OAuth Service: "twitter"

    === 1 OAuth Service for foo_bar_app

    1. "twitter" Service

         Consumer Key:     your_consumer_key

         Consumer Secret:  your_consumer_secret

     

    Now, inside your app's main gadget XML file, define the OAuth service using the same service name you registered on the command line, and the URLs supplied by Twitter for request token, access token, and authorize URL:

     

    <Module>

      <ModulePrefs title="...">

        ...

         <OAuth>

             <Service name="twitter">

               <Access url="http://api.twitter.com/oauth/access_token" method="POST" />

    <Request url="http://api.twitter.com/oauth/request_token" method="POST" />

    <Authorization url="http://api.twitter.com/oauth/authorize" />

             </Service>

         </OAuth>

     

    If you want to remove an OAuth service, there's a command for that too:

     

    $ jiveapps oauth:remove twitter

    Are you sure you wish to remove the OAuth service "twitter"? (y/n)? y

    === Removing Oauth Service "twitter"

    No OAuth Services for foo_bar_app

     

    This concludes the tutorial on how to use the command line tools to register an OAuth service for your app. To continue with the Twitter example tutorial and see the full source code for the app, read more on Using OAuth in your applications.