发送频道消息提示身份验证失败244

莫语 2023-2-9 203

''' @Override public int sendChannelMsg(String channelId, String msgContent) { try {

        MessagePayload payload = new MessagePayload();
        payload.setType(1);
        payload.setSearchableContent("hello world");
        ChannelServiceApi channelServiceApi = new ChannelServiceApi(ImHelper.channelIMUrl, channelId, admin_secret);
        IMResult<SendMessageResult> resultSendMessage = channelServiceApi.sendMessage(0, (List) null, payload);
        if (resultSendMessage != null && resultSendMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
            System.out.println("send message to all the subscriber success");
            return 1;
        } else {
            System.out.println("send message to all the subscriber  failure");
            return 0;
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

'''

最新回复 (6)
  • HeavyRain 2023-2-9
    引用 2
    频道的secret不是admin的secret,上面用错了secret
  • 莫语 2023-2-9
    引用 3

    auth failure

  • HeavyRain 2023-2-9
    引用 4
    new ChannelServiceApi(ImHelper.channelIMUrl, channelId, admin_secret); 
    第三个参数是频道的secret,不是admin的secret,而且每个频道都有自己独立的secret,这个参数你们再检查一下
  • 莫语 2023-2-9
    引用 5
    这个secret是根据每个频道自己生成还是通过API获取的,我看Main中是写死的一个
  • 莫语 2023-2-9
    引用 6
    长度有限制吗
  • 莫语 2023-2-9
    引用 7
    处理好了,从频道信息获取的
返回