Giter Site home page Giter Site logo

logonlabs-js's Introduction

LogonLabs JavaScript

The official LogonLabs JavaScript client library.

Download

https://cdn.logonlabs.com/dist/logonlabs.min.js

LogonLabs API


Instantiating a new client

  • Your APP_ID can be found in App Settings
  • The LOGONLABS_API_ENDPOINT should be set to https://api.logonlabs.com

Create a new instance of LogonClient.

window.logonAsync = function() {
    LogonClient.configure({
        app_id: '{APP_ID}',
        api_path: '{LOGONLABS_API_ENDPOINT}'
    });
};

(function(d, s, id){
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement(s); js.id = id;
    js.src = 'https://cdn.logonlabs.com/dist/logonlabs.min.js';
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'logon-js'));

SSO Login QuickStart

The StartLogin function in the JS library begins the LogonLabs managed SSO process.

LogonClient.startLogin({
    identity_provider: LogonClient.identityProviders.GOOGLE
});

JavaScript Only Workflow

The following workflow is required if you're using JavaScript UI components.

Buttons

This feature allows you to add the identity providers' buttons dynamically as defined in your app-settings.

<div id="logonlabs"></div>
LogonClient.ui.button('logonlabs');

Style in icon format

LogonClient.ui.button('logonlabs', {
    theme: 'icon'
});

Helper Methods

GetProviders

This method is used to retrieve a list of all providers enabled for the application. If an email address is passed to the method, it will return the list of providers available for that email domain.

LogonClient.getProviders('email_address', (res)=> {
    var identity_providers = res.identity_providers;
    for(var i = 0; i < identity_providers.length; i++) {
        //each individual providers available for this email address
    }
});

Decrypt

The JavaScript SDK has built in methods for decrypting strings using AES encryption. Pass in the encrypted value to decrypt.

var decrypt_data = LogonClient.decrypt(encrypted_data);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.