Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
SalesKing oAuth Example Apps
Ruby PHP JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
php
ruby
.gitignore
CHANGELOG.rdoc
README.rdoc

README.rdoc

SalesKing App Examples

SalesKing can be connected and enhanced using the API and Apps. Our Apps are using oAuth2 for authentication and authorization, like you may know it from facebook. When registering your app in SalesKing you get credentials(app id + secret) needed to identify your app and establish a trusted connection.

Examples

Before you start coding:

  • register your app in your SalesKing account ../developers/apps

  • grab a shiny new pair of app key & secret

Depending on the example our are using, Provide the right url's(app and canvas ) in the registration form and then edit the apps settings(inline) or the settings.yml file.

PHP plain

github.com/salesking/sk_app_examples/blob/master/php/plain_oauth.php

Completely stripped down example, visualizing:

  • user authentication

  • app authorization

  • app authentication

One page does it all, no caching or saving of access token or user information, so definitely NOT something you want to use in production.

Ruby

The ruby examples impose some dependencies:

  • Sinatra: as webserver lifting the scripts into your browser

  • Curb(Curl): making the web requests, especially HTTPS without hassle

Most apps use bundler to prevent the gem-hassle and can be racked-up. Sinatra, by default, starts on port 4567, so you should use the following url when registering your app: http ://localhost:4567

Plain login

This is the same as the plain php example, a single view handling the triple-oAuth2 jump. github.com/salesking/sk_app_examples/blob/master/ruby/sinatra_plain/example.rb

Advanced login

The app saves login information(access_token) encrypted in a cookie. It also demonstrates how to deal with dynamic SalesKing URL's(Subdomain for each account).

github.com/salesking/sk_app_examples/tree/master/ruby/sinatra_adv

Push Notifications / PubSub

An app showing how to register for push notifications(WebHooks/PubSub) and how to deal with the callback results

github.com/salesking/sk_app_examples/tree/master/ruby/sinatra_pubsub

Payment chart

Show payment or invoice stats in a zoomable chart.

github.com/salesking/sk_app_examples/tree/master/ruby/sinatra_stats

Something went wrong with that request. Please try again.