ノードアプリケーションプロジェクトで、TwitterAPIをv1.0からv1.1に移行しました。そして、ログファイルにいくつかのエラーが見つかりました。
エラー
{"message":"Could not authenticate you","code":32}
原因
このエラーは、投稿データ(1.1 / statuses / updateへ)に...が含まれている場合に発生します。
- !
- '
- ((
- )。
- *
解決
node-oauthのnode_modules/oauth / lib / oauth.jsにパッチを適用しました(node-twitterのみを使用)...
から
327 if( (method == "POST" || method == "PUT") && ( post_body == null && extra_params != null) ) {
328 post_body= querystring.stringify(extra_params);
329 }
に
327 if( (method == "POST" || method == "PUT") && ( post_body == null && extra_params != null) ) {
328 post_body= querystring.stringify(extra_params);
+331 post_body= post_body.replace(/\!/g, "%21")
+332 .replace(/\'/g, "%27")
+333 .replace(/\(/g, "%28")
+334 .replace(/\)/g, "%29")
+335 .replace(/\*/g, "%2A");
336 }
TwitterAPIv1.0はこのパッチを必要としません。v1.1のみが、このパッチがポスト本文を二重にエスケープする必要があります。この変更により、このライブラリを他のoauthサービスに使用できなくなるため、私のパッチはユニバーサルではないと思います...
私の質問
- これはnode-oauthの問題またはTwitterAPIの問題(Twitterの仕様の変更またはバグ)ですか?
- この問題を誰に報告すればよいですか?