我使用无人驾驶的OAuth工作在Adobe AIR for Desktop,iOS上,但不是Android。 出于某种原因,我们没有得到oauth_verifier(包含 在Android设备上的StageWebView中使用sha'd code。任何线索?这是 在桌面和Droid 2上调试;注意缺少Droid 2跟踪输出中的第3行 回调URL之后的所有OAuth变量。
桌面:
AuthorizeTwitterService::onComplete, data:
oauth_token=De2k4zANjzAhT3hXV4eqOfTVxJsshVIJjgsuwPMUg8&oauth_token_secret=s WsBzyS43nh6DDBwLaogaWpVftoDaiYTJDfBKQE&oauth_callback_confirmed=true
--------------------
TwitterLoginView::onLocationChange
location:
https://api.twitter.com/oauth/authorize?oauth_callback=oob&applicatio...
--------------------
TwitterLoginView::onLocationChange
location: https://api.twitter.com/oauth/authorize
--------------------
TwitterLoginView::onLocationChange
location:
http://www.twitter.com/combovercharlie?oauth_token=De2k4zANjzAhT3hXV4&oauth_verifier=js1B4bAYfUer05a2rlZSDcOLOaIa66q93K24FUzrk
Droid 2:
AuthorizeTwitterService::onComplete, data:
oauth_token=BtwJHbpaS5OWy1AMYdwl0ecGKGpU9AEcyrFYaXQ8&oauth_token_secret=Z2C ff3ECfY5dp8dLLSA9qXvL2SRaZ3v5veStGuA00&oauth_callback_confirmed=true
--------------------
TwitterLoginView::onLocationChange
location:
https://api.twitter.com/oauth/authorize?oauth_callback=oob&applicatio...
Charlie&oauth_token=BtwJHbpaS5OWy1AMYdwl0ecGKGpU9AEcyrFYaXQ8&oauth_consumer _key=LbMYslVau91uSAMZyGsOg
--------------------
TwitterLoginView::onLocationChange
location: https://api.twitter.com/oauth/authorize
--------------------
TwitterLoginView::onLocationChange
location: http://mobile.twitter.com/combovercharlie
答案 0 :(得分:0)
我通过Event.COMPLETE为我的Droid 2和Nexus One修复了它。我甚至没有在我的桌面和Android上获得LocationChangeEvent.LOCATION_CHANGING,但是底线,Event.COMPLETE确实得到了oauth_verifier sha'd pin。我可以解析StageWebView的位置属性,提交,我很高兴。出于偏执,我将在那里留下所有3个事件以防万一。如果你很好奇,这里是通过Mark Lochrie的操作系统之间的重定向事件差异:http://kb2.adobe.com/cps/895/cpsid_89526.html。
此外,假设您的应用程序实际上已注册为“Web应用程序”,而不是桌面应用程序,否则,您将被迫使用引脚,并且您不会在响应URL中获得oauth_verifier。是的,您可以根据需要编制回调网址;只是确保它是一个标准的URL,希望不是404。
stageWebView = new StageWebView();
stageWebView.addEventListener(LocationChangeEvent.LOCATION_CHANGING, onLocationChange);
stageWebView.addEventListener(LocationChangeEvent.LOCATION_CHANGE, onLocationChange);
stageWebView.addEventListener(Event.COMPLETE, onLocationChange);
stageWebView.stage = stage;
stageWebView.viewRect = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);
// loaded from an OAuth library
// try http://code.google.com/p/oauth-as3/ or Tweetr http://wiki.swfjunkie.com/tweetr
stageWebView.loadURL(authenticationURL);
var code:String;
function onLocationChange(event:Event):void
{
var location:String;
if(event is LocationChangeEvent)
{
location = LocationChangeEvent(event).location;
}
else
{
location = _stageWebView.location;
}
var search:String = "oauth_verifier=";
var ver:String = location;
var startIndex:int = ver.lastIndexOf(search);
if(startIndex != -1)
{
code = ver.substr(startIndex + search.length, location.length);
// remove listeners and dispatch success here
}
}