AIR移动Twitter OAuth没有返回oauth_verifier

时间:2014-04-15 13:27:11

标签: authentication ssl twitter air

这是我的Twitter登录代码,我试图在AIR mobile中使用它

requestToken = OAuthUtil.getTokenFromResponse(e.currentTarget.data);                     var authRequest:URLRequest = new URLRequest('http://api.twitter.com/oauth/authorize?oauth_token='+ requestToken.key +'& force_login = true');

                // StageWebView to Authorize the App
                twitterWebView = new StageWebView();
                twitterWebView.viewPort = new Rectangle(FlexGlobals.topLevelApplication.width/2 - FlexGlobals.topLevelApplication.width *.45,FlexGlobals.topLevelApplication.height -FlexGlobals.topLevelApplication.height * .94 ,(FlexGlobals.topLevelApplication.width* .90),FlexGlobals.topLevelApplication.height * .85);
                twitterWebView.stage = this.stage;
                twitterWebView.assignFocus();
                twitterWebView.loadURL(authRequest.url);
                twitterWebView.addEventListener(LocationChangeEvent.LOCATION_CHANGE, onLocationChange);
                twitterWebView.addEventListener(Event.COMPLETE, onLocationEventCompete);
                twitterWebView.addEventListener(ErrorEvent.ERROR,handleError);

现在问题出在onLocationEventCompete我试图得到 var search:String =“oauth_verifier =”;

但是twitter返回的url中缺少oauth_verifier参数。 并给我在webView中打印的错误消息是SSL是必需的。

请指导我在这里做错了什么

1 个答案:

答案 0 :(得分:0)

authRequest:URLRequest =新的URLRequest(' http://api.twitter.com/oauth/authorize?oauth_token=' + requestToken.key +'& force_login = true');

将协议更改为https  例如:  authRequest:URLRequest =新的URLRequest(' https :// api.twitter.com/oauth/authorize?oauth_token =' + requestToken.key +'& force_login =真&#39);