» Working with Login & Logout

Working with Login & Logout

In this section, we will explain how the WebCommander login and logout API works and how to secure a source URL from a plugin that is rendered through an iframe inside the WebCommander site. We’ll provide code examples in various programming languages to help you understand the implementation.

Overview

The Payment Module in the Exsited SDK provides a robust set of tools to handle payment-related operations within your application. It allows developers to streamline payment processing, apply payments to invoices, and retrieve detailed payment histories for auditing or reconciliation purposes. Designed for versatility, this module supports a wide range of payment processors and ensures accurate financial tracking.

curl --location 'http://yourapp.com/external/app/access/customer-login' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "clientId": "abf9ab31352bfc92f5a6a5b891782b9f", 
    "email": "tanviruls8@gmail.com", 
    "password": "123456"
}'

Request Details

  • Request URL: http://yourapp.com/external/app/access/customer-login
  • Request Type: POST

Request Parameter

{
    "clientId": "abf9ab31352bfc92f5a6a5b891782b9f", // you will find the clientID on plugin installation. Check /install request parameter in project setup section.
    "email": "tanviruls8@gmail.com", // accepted parameters - email or userName
    "password": "4465234235667"
}

Response

{
    "status": "success",
    "access_token": "abf9ab31352bfc92f5a6a5b891782b9f", // To secure a plugin source URL that is used to render through iframe in WebCommander.
    "refresh_token": "fda44530af4b9b11d48d263fe499c146" // 
}

Example

As an example, suppose you want to register a plugin widget where your sourceUrl is https://stage-mnb.clubeez.com/signup-widget?uuid=BB1EF6AA-A8E0-4D0F and configurationUrl is https://stage-mnb.clubeez.com/configuration-signup-widget?uuid=BB1EF6AA-A8E0-4D0F. WebCommander will send an additional parameter token (e.g., https://stage-mnb.clubeez.com/my-subscriptions?token=BB1EF6AA-A8E0-4D0F-86B5-751EAD851890) when they are rendered through an iframe in WebCommander. The plugin developer can check the token to validate the login and identify who is responsible for rendering their internal page.

    "widgets": [
        {
            "widgetName": "mining", //unique internal identifier of widget(no space and special character and number allowed) 
            "widgetLabel": "Mining Signup", //widget display name  
            "widgetTitle": "Mining Signup Widget", //widget title will show on hover Widget 
            "widgetLogo": "https://stagingmining.mywebcommander.com/template/9738593f/images/package-pricing-icon.svg", // The URL of the logo of this widget
            "sourceUrl": "https://stage-mnb.clubeez.com/my-subscriptions?uuid=BB1EF6AA-A8E0-4D0F", // widget render source url 
            "configurationUrl": "https://stage-mnb.clubeez.com/configuration-signup-widget?uuid=BB1EF6AA-A8E0-4D0F", //widget configuration endpoint url 
        }
    ]

User Logout

The plugin developer can send a request to log out a user where WebCommander will clear the token generated for that user.

curl --location 'http://yourapp.com/external/app/access/customer-logout' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "token": "abf9ab31352bfc92f5a6a5b891782b9f" 
}

Request Details

  • Request URL: http://yourapp.com/external/app/access/customer-logout
  • Request type: POST

Request Parameter

{
    "token": "abf9ab31352bfc92f5a6a5b891782b9f" // The access token you recieved during login
}

Response

{"status":"success","message":"Successfully Logout"}