Expandir minha barra de realizações na Comunidade.

Submissions are now open for the 2026 Adobe Experience Maker Awards

Mark Solution

Esta conversa foi bloqueada devido à inatividade. Crie uma nova publicação.

SOLUCIONADO

How to pass input credentials for xtk:session#logon web service

Avatar

Level 7

Hello Folks,

Hope you're doing well

We are leveraging OOTB provided API's for our requirement, as a part of it I am doing 2 calls:

  • To Xtk:Session#Logon Service to generate a session token, security token.
  • To Xtk:Session#Write by supplying required parameters along with Session Token for Authorization

I was able to do this from SOAP by passing credentials (username/password) to get session token and write data, but when it comes to doing via code (JavaScript), how can I pass credentials as input to generate session token thereby ensuring it is not visible anywhere in Code ? Is there anyway to mask credentials ?

Please help with suggestions

@Adhiyan @Jonathon_wodnicki @Vipul_Raghav @_Manoj_Kumar_ 

Thanks,

SSB

1 Solução aceita

Avatar

Resposta correta de
Level 10

Hi @SriBhargav_94 

you can use the following:

function getToken(url, username, password) {

    var cnx = new HttpSoapConnection(url);
    var session = new SoapService(cnx, 'urn:xtk:session');

    session.addMethod("Logon", "xtk:session#Logon",
        ["sessiontoken", "string", "Login", "string", "Password", "string", "Parameters", "NLElement"],
        ["sessionToken", "string", "sessionInfo", "NLElement", "securityToken", "string"]);

    var res = session.Logon("", username, password,  <param/>);
    var token = res[0];
    var securityToken = res[2];

    return {
        token: token,
        securityToken: securityToken
    };
}

You can encrypt credentials and store them within the options. When call above function you can decrypt them in JS and pass as parameters.

 

Regards,
Milan

Ver solução na publicação original

1 Resposta

Avatar

Resposta correta de
Level 10

Hi @SriBhargav_94 

you can use the following:

function getToken(url, username, password) {

    var cnx = new HttpSoapConnection(url);
    var session = new SoapService(cnx, 'urn:xtk:session');

    session.addMethod("Logon", "xtk:session#Logon",
        ["sessiontoken", "string", "Login", "string", "Password", "string", "Parameters", "NLElement"],
        ["sessionToken", "string", "sessionInfo", "NLElement", "securityToken", "string"]);

    var res = session.Logon("", username, password,  <param/>);
    var token = res[0];
    var securityToken = res[2];

    return {
        token: token,
        securityToken: securityToken
    };
}

You can encrypt credentials and store them within the options. When call above function you can decrypt them in JS and pass as parameters.

 

Regards,
Milan