Skip to content
balnagy edited this page Mar 8, 2012 · 4 revisions

Welcome to the creatary-js-sdk wiki!

Creatary.init(client_id, [options])

client_id (string): Your application's client id (also called consumer key)

options (object) [optional]: configuration object

  • login_method (string): 'sms' or 'password'. 'sms' means login with pin code sent via sms, 'password' for existing Creatary users with name-password pair
  • pre_set_msisdn (string): Preset phone number for the subscriber, it should be without whitespaces and leading + or 00. Example: '18008291040'
  • callback(code) (function): Function to be called if authorization succeeds.
  • code (string): OAuth2 code
  • error_callback() (function): Function to be called if authorization fails. (for example user rejects application)
  • loglevel (number) Log level that this library will use. Possible values are: Creatary.log.DEBUG / ERROR / OFF. Default level: ERROR

Example:

Creatary.init('client_id', {
        // Authorized callback
        callback : function(code) {
            $('#result').html('Thanks for enabling my app!');
            $.post('ajax.php?code_arrived=1', { code: code });
        },
        // Rejected callback
        error_callback : function() {
            $('#result').html('You will not be able to use my app. Are you sure?');
        }
    });

Creatary.auth()

Starts the authorization process, when it's finished the callback functions defined by init() are called.

Clone this wiki locally