问题描述
WebIM如何使用token方式登录呢? token值如何获取呢?
解决方案
conn.open({apiUrl : apiURL,user : user,appKey : appkeyaccessToken : 'YWMt8bfZfFk5EeSiAzsQ0OXu4QAAAUpoZFOMJ66ic5m2LOZRhYUsRKZWINA06HI'});就像这样,把pwd注释掉,填上用户token就行。至于获取用户TOKEN,用rest接口吧,跟获取token一样,不过type 改成password client_id 改成username ,client_secret 改成password
解决方案二:
获取token,试了一下,这样是可行的,希望官方能完善这部分的文档curl -X POST "https://a1.easemob.com/easemob ... ot%3B -d '{"grant_type":"password","username":"[用户名]","password":"[用户密码]"}'返回:{ "access_token": "YWMtAES_rj8YEeWdL83j9WiRfQABAVBK2dgt4rF8_mjBWEQj92XLx_VitClLKcI", "expires_in": 5184000, "user": { "uuid": "f10c80aa-3f57-11e5-8bf5-8b865b909076", "type": "user", "created": 1439180756878, "modified": 1439180756878, "username": "test", "activated": true }}