Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

scandit-flow-sdk

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scandit-flow-sdk

Scandit Flow - JavaScript SDK

  • 0.0.5
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
2
Weekly downloads
 
Created
Source

Scandit Flow JavaScript SDK

Build Status

The Scandit Flow JavaScript SDK is a library that helps building applications integrated with the Scandit Flow platform.

Take a look at our related projects:

Getting started

In order to start using the SDK you must have a Scandit Flow account.
At the moment the only way to sign up is using the mobile app (Scandit Flow - Android, Scandit Flow - iOS).

Once you have your account, log in to the web dashboard and configure access under API Access.

Installing

Using npm (for NodeJS):

$ npm install scandit-flow-sdk

Using bower:

$ bower install scandit-flow-sdk

Manually (downloaded from Releases):

<script src="scandit.min.js"></script>

Usage

Client initialization
Static key access:
var client = new Scandit.Client({
    method: Scandit.Auth.Method.STATIC_KEY,
    key: '-- YOUR STATIC API KEY --'
});

client.init()
    .then(function(authenticationStatus) {
        if (authenticationStatus) {
            console.log('Static key is valid');
            // you can use the client
        } else {
            console.log('Invalid static token');
        }
    })
    .catch(function(err) {
        console.log('Unexpected error during initialization: ' + err);
    });
User login (only works in a web browser) (OAuth Implicit):
var client = new Scandit.Client({
    method: Scandit.Auth.Method.USER_IMPLICIT,
    clientId: '-- YOUR CLIENT ID --',
    redirectUri: '-- YOUR REDIRECT URI --',
    popup: true
});

client.init()
    .then(function(authenticationStatus) {
        if (authenticationStatus) {
            console.log('You are authenticated');
            // you can use the client
        } else {
            console.log('User must login');
            // Use code below to authenticate user, e.g. after user clicks the login button
            // client.authenticate()
            //     .then((function () {
            //         console.log('Authenticated successfully');
            //     }))
            //     .catch(function (err) {
            //         console.log('Authentication failed: ' + err);
            //     });
        }
    })
    .catch(function(err) {
        console.log('Unexpected error during initialization: ' + err);
    });
Client credentials (OAuth Client Credentials)
var client = new Scandit.Client({
    method: Scandit.Auth.Method.CLIENT,
    clientId: '-- YOUR CLIENT ID --',
    clientSecret: '-- YOUR CLIENT SECRET --'
});

client.init()
    .then(function(authenticationStatus) {
        if (authenticationStatus) {
            console.log('Client is authenticated');
            // you can use the client
        } else {
            console.log('Login needed');
            // Use code below to authenticate client, e.g. can be triggered automatically or with a button click etc.
            // client.authenticate()
            //     .then((function () {
            //         console.log('Authenticated successfully');
            //     }))
            //     .catch(function (err) {
            //         console.log('Authentication failed: ' + err);
            //     });
        }
    })
    .catch(function(err) {
        console.log('Unexpected error during initialization: ' + err);
    });
Client usage

At the moment the only client functionality is accessing the Scandit Flow Cloud DB.
In order to start using it you have to configure your database. Go to the Database section on the web dashboard and define some classes.

Retrieving a list of configured models:

client.Db.getAvailableModels()

Fetching all objects from the model (where ModelName is the class name you specified on the web dashboard):

client.Db.ModelName.all()
    .then(function(objects) {
        console.log(objects);
    })
    .catch(function(error) {
        console.log('Cannot fetch objects: ' + error);
    });
Usage examples

For more detailed examples please take a look at the examples folder.

Documentation

API documentation will be available soon. For general documentation please refer to Scandit Flow - Documentation.

License

The source code published here is released under the Apache 2.0 license: http://www.apache.org/licenses/LICENSE-2.0.

Questions? Contact support@scandit.com.

FAQs

Package last updated on 24 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc