问题描述
我参考获取token的文档来写的,获取token;我的方法:String content = "{"grant_type":"client_credentials","client_id”:"YXA6xdoZIANQEeWix1fjFvDbug","client_secret":"YXA6mQzq2AZEPPa2d4fZSE5vDr25YP0"}"; String sr=HttpRequest.sendPost("https://a1.easemob.com/wazert/wazerthnt/token", content); **.out.println(sr);返回:java.io.IOException: Server returned HTTP response code: 400 for URL: https://a1.easemob.com/wazert/wazerthnt/token at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1305) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234) at com.wazert.huanxin.HttpRequest.sendPost(HttpRequest.java:101) at com.wazert.huanxin.Test.main(Test.java:20)我确定content中的内容都写好的,都是对的,我今天对了一下午了;我用的注册:String user = "{"username":"18667179666","password":"18667179666", "nickname":"zhaozhuo"}";String sr=HttpRequest.sendPost("https://a1.easemob.com/wazert/wazerthnt/users", user ); **.out.println(sr);都是可以的;
解决方案
参考java demo https://github.com/easemob/emchat-server-examples
解决方案二:
> forum.php?mod=redirect&goto=findpost&pid=3516&ptid=1664参考java demo https://github.com/easemob/emchat-server-examplesthanks very mach~