You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I love the succitness and elegance of cote, its always worked for until now, I have this minor problem and have tried everything with no good result yet, what am i doing wrong in calling like this, "res.redirect(bitrix24.auth.authorization_uri);" is it forbidden to call the internal app.get from cote, how can i go around this?
Hello @cohabo! Did you make any progress on this? It's hard for me to understand how you are making use of cote in this scenario. For example, the Sockend component doesn't have a connect method.
Hi Armagan,
I love the succitness and elegance of cote, its always worked for until now, I have this minor problem and have tried everything with no good result yet, what am i doing wrong in calling like this, "res.redirect(bitrix24.auth.authorization_uri);" is it forbidden to call the internal app.get from cote, how can i go around this?
`const app = require('express')(),
server = require('http').Server(app),
io = require('socket.io')(server),
cote = require('cote');
const b24 = require('b24');
// A Responder that shall listen for the Rest Api calls
const responder = new cote.Responder({ name: ' bitrix rest calls API responder ' });
const ios = new cote.Sockend(io, { name: 'end-user sockend server' });
// // A Publisher that shall notify for the Rest API calls
// const publisher = new cote.Publisher({ name: 'arbitration publisher' });
// const subscriber = new cote.Subscriber({ name: 'arbitration subscriber' });
// B24 setup
const bitrix24 = new b24.Bitrix24({
config: {
mode: "api",
host: "wwwwww",
client_id : "xxxxxxxxxxxxx",
client_secret : "xxxxxxxxxxxx",
redirect_uri : "xxxxxxxxxxxxxxxxxx"
},
methods: {
async saveToken(data){
//Save token to database
},
async retriveToken(){
//Retrive token from database
return {
access_token: "youraccesstoken",
refresh_token: "yourrefreshtoken"
}
}
}
})
app.get('/auth', function (req, res) {
console.log(
${req.ip} requested end-user interface
);});
server.listen(3000);
// Bitrix auth
responder.on('api', (req, res) => {
ios.connect('/auth');
});
// Callback service parsing the authorization token and asking for the access token
app.get('/callback', async (req, res) => {
try{
const code = req.query.code;
console.log(code);
const result = await bitrix24.auth.getToken(code);
console.log(result);
return res.json(result);
}catch(err){
console.log(err)
return res.status(500).json({message:"Authentication Failed"});
}
});`
The text was updated successfully, but these errors were encountered: