2015-12-22 67 views
1

我正尝试使用OAuthSwift在我的应用中获取用户的access token。我已经这样做了TwitterInstagram,但Facebook不帮我。Facebook OAuthSwift redirect_uri不支持iOS

我使用的代码如下:

func doOAuthFacebook() { 
    let oauthswift = OAuth2Swift(
     consumerKey: "@@@@", 
     consumerSecret: "####", 
     authorizeUrl: "https://www.facebook.com/dialog/oauth", 
     responseType: "token" 
    ) 
    oauthswift.authorizeWithCallbackURL(NSURL(string: "myApp://myApp/facebook")!, scope: "publish_stream,email", state: "FACEBOOK", success: { (credential, response, parameters) -> Void in 

     self.showAlertView("Facebook", message: "oauth_token:\(credential.oauth_token)") 

     }) { (error) -> Void in 

      print (error.localizedDescription) 
    } 
} 

,我使用作品的另两个社交网络的callbackURL。来自Facebook的Safari浏览器时试图打开的页面我收到这样的信息:

The redirect_uri URL is not supported

我不知道有没有做一些事来我的应用程序在Facebook Developers页面,或者是别的东西。

+0

为什么不使用Facebook SDK? – WizKid

+0

我正在使用OAuthSwift框架为Instagram和Twitter执行相同的操作,我试图维护Facebook请求类似 –

+1

redirect_uri必须是https并且与您在进行客户端注册时注册的值相同。 – jwilleke

回答