Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circuit node with session token #1

Open
rhaenggi opened this issue Oct 27, 2017 · 5 comments
Open

Circuit node with session token #1

rhaenggi opened this issue Oct 27, 2017 · 5 comments

Comments

@rhaenggi
Copy link

Hi,
we want to used the Circuit node-red-contrib-circuit but realized that you don't have implemented a node in/out with session toke.
Would you mind to enhance your package with the possibility to work with session token.
This would be an important enhancement for us.

@rogeru
Copy link
Member

rogeru commented Oct 30, 2017

Hi @rhaenggi, can you clarify what node in/out you need? Is it the OAuth access token with which you can login similar to the SDK logon with an access token? https://circuitsandbox.net/sdk/classes/Client.html#method_logon

@rhaenggi
Copy link
Author

Roger,
greetings from Switzerland hope you still have a good memory of it :-)
To be more precise we got a client sample code node.js how to do the integration, however in the standard Node-Red nodes we could not find out if and how to make this kind of integration, here a sample node.js code we got from the client.
The session Token is what seams to be the only possibility so fare the client has to use Circuit chatbot.
Hope the sample code helps to understand.

let Circuit = require("CircuitClient.js");

let sessionToken = "insertSessionTokenHere";

let circuitClient = new Circuit.Client({
domain: "circuit.siemens.com",
cookie: "connect.sess=" + sessionToken
});

//nachrichten empfangen
circuitClient.addEventListener("itemAdded", (event) => handleItemAdded(event));
circuitClient.addEventListener("itemUpdated", (event) => handleItemUpdated(event));

//einloggen
circuitClient.logon().then(() => {
console.log("CircuitChannelHandler: connected to circuit");
}).catch(() => {
console.log("CircuitChannelHandler: connection to circuit failed");
});

//nachricht senden
let message = {
convId: "conversationId",
content: "messageToSend",
parentId: "idOfParentCircuitElement"
};

circuitClient.addTextItem(
message.convId,
message
).catch((e) => {
console.log(e);
});

@rogeru
Copy link
Member

rogeru commented Oct 30, 2017

Login with a session cookie was a work around we allowed prior to OAuth 2.0 support.
The authentication types the SDK supports are listed at https://github.com/circuit/circuit-sdk#application-types.

For node-red it seems we only support CLIENT CREDENTIALS grant. @mailsvb is that correct?

@rhaenggi, you can register for an OAuth app at https://circuit.github.io/oauth to get your client_id and client_secret.

Haven't been back to CH in a few years now. Hopefully soon.

@rhaenggi
Copy link
Author

Roger,
the problem is your very large client in Germany does only support this kind of integration and this will not change fast. That's the reason why I approached you. Do you have an older node-red version who supported session cookie or any hint how to get this working?

@rogeru
Copy link
Member

rogeru commented Oct 30, 2017

No sorry, that is not supported anymore. Rather than discussing this here, let's have a chat or a call on circuitsandbox.net or eu.yourcircuit.com and hopefully we can find the best authentication solution for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants