Skip to content

Authentication

Project Startup

Select the correct Kelvin SDK Client platform (Angular / React / Vue / NodeJs) to develop the application and install the necessary dependencies. After, import the KelvinSDK class to the application and call the initialize method with the necessary properties. Check options to initialize below.

KelvinSDK.initialize({ ... });

Authentication Process

When the initialization of the KelvinSDK is, made we need to decide if we want to manage all the authentication process manually with our service or if we prefer to use keycloak to handle this process. The initial configuration changes slightly from one choose to another.

  • Keycloak Authentication

    The keycloak library is used to provide the sign-on in our system and can be used for UI based applications. It's necessary to install the keycloak-js npm package in application project and provide the necessary information.

    KelvinSDK.initialize({
        baseUrl: '<base-url>'
    });
    
    Keycloak.init({
        config: {
            clientId: '<kelvin-provided-client-id>',
            realm: '<kelvin-provided-realm>',
            url: '<kelvin-provided-url>'
        },
        ...
    });
    

  • Manual Authentication

    In this process it is necessary to configure the initialize method with more properties. The AuthService will be available with methods like login, logout, renewSession. Check the API reference for more details. If session tokens are provided, you can set the property sessionConfig with them.

    KelvinSDK.initialize({
        baseUrl: '<base-url>',
        authConfig: {
            clientId: '<kelvin-provided-client-id>',
            realm: '<kelvin-provided-realm>',
            url: '<kelvin-provided-url>',
        },
        // Optional
        sessionConfig: {
            accessToken: '<kelvin-platform-access-token>',
            refreshToken: '<kelvin-platform-refresh-token>'
        }
    });
    
    AuthService.login(...);
    

KelvinSDK.initialize reference:

Property Required Description Example
baseUrl True The base URL provided by Kelvin for your company https://xxx.kelvininc.com/api/v4
authConfig False The configuration that our system is going to use to authenticate in system
sessionConfig False Session authentication tokens

The authConfig has the follow properties:

Property Required Description Example
clientId True This is provided by Kelvin kelvin-client
realm True This is provided by Kelvin kelvin-realm
URL True The URL that your company use to authenticate in our system https://xxx.kelvininc.com/auth

The sessionConfig has the follow properties:

Property Required Description
accessToken True Platform session access token
refreshToken True Platform session refresh token

API Documentation

For detailed API reference documentation follow here