To initialize and authenticate to the Liminal platform, use the following code:

let liminalJs=new LiminalJs(LiminalEnvironment.test);
await liminalJs
  .Authenticate({
  clientId: "YOUR_CLIENT_ID",
  clientSecret: "YOUR_CLIENT_SECRET"
}).AuthenticateWithAccessToken();
let liminalJs:LiminalJs=new LiminalJs(LiminalEnvironment.test);
            await liminalJs
                    .Authenticate({
                        clientId: "YOUR_CLIENT_ID",
                        clientSecret: "YOUR_CLIENT_SECRET"
                    })
                    .AuthenticateWithAccessToken();
To Initialize your environment in the constructor of LiminalJs:
EnvironmentCode
testLiminalEnvironment.test
prodLiminalEnvironment.prod
In this case, You have to send your Client ID and Client Secret information in the Authenticate function Parameter. This option is available only for confidential applications (such as applications that are able to hold credentials in a secure way without exposing them to unauthorized parties). Once you are authorized from the system then you are able to access our Liminal features.

Full example of Authentication

import { LiminalJs,LiminalEnvironment } from "@lmnl/liminaljs";

const main = async () => {
    try {
        let liminalJs = new LiminalJs(LiminalEnvironment.test);
        await liminalJs
            .Authenticate({
                clientId: "YOUR_CLIENT_ID",
                clientSecret: "YOUR_CLIENT_SECRET"
            })
            .AuthenticateWithAccessToken();
    }
    catch (ex) {
        throw ex;
    }
};
main().then((resolve) => console.log("Complete")).catch((error) => console.log(error));
import { LiminalJs,LiminalEnvironment } from "@lmnl/liminaljs"

const main = async (): Promise<void> => {
    try {
        let liminalJs: LiminalJs = new LiminalJs(LiminalEnvironment.test);
        await liminalJs
            .Authenticate({
                clientId: "YOUR_CLIENT_ID",
                    clientSecret: "YOUR_CLIENT_SECRET"
            })
            .AuthenticateWithAccessToken();
    }
    catch (ex) {
        throw ex;
    }
}

main().then((resolve) => console.log("Complete")).catch((error) => console.log(error));

Did this page help you?