Tag: twitter

Kotlin Twitter Outh-Signature

我试图得到一个有效的oaut签名,但我无法做到这一点。 我在网上搜索了一段时间,发现了一些有用的网站,但即使有90%的代码,它不工作。 我已经有了消费者密码,消费者密码,访问令牌和令牌密码。 我创建了我已经拥有的所有参数(NameValuePair)的列表,并在我对它们中的每一个进行百分比编码之后,通过键对它们进行排序。 然后我建立基本上是百分比编码的汇总的签名基本字符串。 随着消费者的秘密和令牌的秘密也编码和合并与他们之间的“&”我扔在HMAC-SHA1函数签名基础字符串和新创建的密钥混合字符串。 该函数的结果是一个byteArray,然后转换为一个字符串并用作oauth_signature。 但它没有工作。 我不能进一步调试,因为我刚开始一个HTTP请求后得到一个401 HTTP错误授权请求。 有什么建议么 ? private fun generateNonce(): String { val random = Random() return java.lang.Long.toString(Math.abs(random.nextLong())) + System.currentTimeMillis() } private fun generateSignature(signatueBaseStr: String, oAuthConsumerSecret: String, oAuthTokenSecret: String?): String { var byteHMAC: ByteArray? = null try { val mac = Mac.getInstance(“HmacSHA1”) val spec: SecretKeySpec spec = if (null == […]

如何获得电子邮件ID微博整合

我正在使用Twitter的集成使用结构,现在的问题是我能够得到除了电子邮件地址的用户的所有细节。 以下是我的代码,任何人都可以帮助我 public void login(Result<TwitterSession> result) { //Creating a twitter session with result's data TwitterSession session = result.data; //Getting the username from session final String username = session.getUserName(); //This code will fetch the profile image URL //Getting the account service of the user logged in Call<User> userResult = Twitter.getApiClient(session).getAccountService().verifyCredentials(true, false); userResult.enqueue(new Callback<User>() { @Override public […]

使用Kotlin添加自定义的Twitter REST API查询

我是Kotlin的新手。 我正在构建一个像Twitter的应用程序。 我想创建自定义类扩展TwitterApiClient – 使用更多的端点。 Twitter的教程在这里教程 这是我的代码: class TwitterApiList(session: TwitterSession) : TwitterApiClient(session) { fun getHomeTimeline(): TwitterCustom { return getService(TwitterCustom::class.java) } } // TwitterCustom interface public interface TwitterCustom { @GET("/1.1/statuses/home_timeline.json") fun home_timeline(@Query("count") count: Int?, @Query("since_id") since_id: Int?, @Query("max_id") max_id: Int?, cb: Callback<List<Tweet>>) } // And how I use it val apiClient = TwitterApiList(TwitterCore.getInstance().sessionManager.activeSession) apiClient.getHomeTimeline().home_timeline(null, null, null, […]