【问题标题】:RingCentral Glip Bot OAuthRingCentral Glip Bot OAuth
【发布时间】:2018-06-20 00:12:48
【问题描述】:

在 RingCentral 平台中为 Glip Bot 应用程序实施 OAuth 的新方法/方法是什么? (RingCentral 开发者门户现在可以获取 Glip Bot 应用程序的永久访问令牌)

app.get('/oauth', function (req, res) {
    if(!req.query.code){
        res.status(500);
        res.send({"Error": "Looks like we're not getting code."});
        console.log("Looks like we're not getting code.");
    }else {
        platform.login({
            code : req.query.code,
            redirectUri : REDIRECT_HOST + '/oauth'
        }).then(function(authResponse){
            var obj = authResponse.json();
            bot_token = obj.access_token;
            console.log(obj);
            console.log(bot_token);
            res.send(obj)
            subscribeToGlipEvents();
        }).catch(function(e){
            console.error(e)
            res.send("Error: " + e);
        })
    }
});

【问题讨论】:

    标签: oauth bots chatbot ringcentral glip


    【解决方案1】:

    新方法将使用POST,而不是如下所示的get

    app.post('/oauth', function(req, res){
        var token = req.body.access_token;
        creatorID = req.body.creator_extension_id; 
        console.log(token);
        res.send({});
        var data = platform.auth().data();
        data.token_type = "bearer"
        data.expires_in = 500000000
        data.access_token = token
        platform.auth().setData(data)
        getBotIdentity();
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-23
      • 2021-05-25
      相关资源
      最近更新 更多