Actionscript 3 需要Twitter和TwitPic Oauth的图像上传应用程序吗?
简单地将图像上传到twitpic有问题吗 即使我的用户名和密码正确,我仍然会收到失败响应。 这是因为现在要将图像上传到twitpic(我假设是Twitter),您必须使用Oauth吗Actionscript 3 需要Twitter和TwitPic Oauth的图像上传应用程序吗?,actionscript-3,twitter,air,oauth-2.0,Actionscript 3,Twitter,Air,Oauth 2.0,简单地将图像上传到twitpic有问题吗 即使我的用户名和密码正确,我仍然会收到失败响应。 这是因为现在要将图像上传到twitpic(我假设是Twitter),您必须使用Oauth吗 <err code="1001" msg="Invalid twitter username or password" /> 我阅读了文档,您的请求缺少两个API的参数。如果您使用的是V1 API,则需要传递应用程序ID和其他信息。v2api使用OAuth 谢谢,但V1和V2都使用Oauth。我的
<err code="1001" msg="Invalid twitter username or password" />
我阅读了文档,您的请求缺少两个API的参数。如果您使用的是V1 API,则需要传递应用程序ID和其他信息。v2api使用OAuth
谢谢,但V1和V2都使用Oauth。我的问题是Oauth对于上传图像数据是否绝对必要。
package
{
import flash.events.DataEvent;
import flash.events.Event;
import flash.filesystem.File;
import flash.net.FileFilter;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;
public class TwitPic
{
private var _file:File;
public function TwitPic()
{
_file = new File();
_file.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,uploadCompleteDataHandler);
browse();
}
private function browse():void {
_file.addEventListener(Event.SELECT, fileSelected);
_file.browse( new Array( new FileFilter( "Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg;*.jpeg;*.gif;*.png" ) ) );
}
private function fileSelected(event:Event):void {
var urlRequest:URLRequest = new URLRequest("http://twitpic.com/api/upload");
// The API requires the request be sent via POST
urlRequest.method = URLRequestMethod.POST;
// Enter a valid Twitter username / password combination
var urlVars:URLVariables = new URLVariables();
urlVars.username = TWITTER_USERNAME;
urlVars.password = TWITTER_PASSWORD;
urlRequest.data = urlVars;
// The API requires the file be labeled as 'media'
_file.upload(urlRequest, 'media');
}
private function uploadCompleteDataHandler(event:DataEvent):void
{
var resultXML:XML = new XML(event.text);
// Trace the path to the resulting image tiny url (mediaurl)
trace(resultXML.child("mediaurl")[0]);
}
}
}