Skip to content

raijintl1/logonlabs-js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 87.7%
  • CSS 12.3%