OAuth Swift:Dribbble app的“回调”网址是什么?

时间:2015-04-06 02:45:25

标签: ios swift oauth callback url-redirection

我正在制作一个使用OAuthSwift进行Dribbble登录的应用程序,一切顺利(当然我在Dribbble开发者页面上设置了应用程序,我有我的客户端ID和密码)。

但是当它询问用户是否接受权限时,回调不起作用。

我做了我的URL回调“DribbbleChat2:// oauth-callback”,我在Xcode Infos中制作了一个URL方案“oauth-callback”

请问您可以帮我将身份验证重定向到我的应用程序吗?

Redirect fail

这是我的回调网址

的功能
func doOAuthDribbble(){
    let oauthswift = OAuth2Swift(
        consumerKey:    Dribbble["consumerKey"]!,
        consumerSecret: Dribbble["consumerSecret"]!,
        authorizeUrl:   "https://dribbble.com/oauth/authorize",
        accessTokenUrl: "https://dribbble.com/oauth/token",
        responseType:   "code"
    )
    oauthswift.authorizeWithCallbackURL( NSURL(string: "DribbbleChat2://oauth-callback")!, scope: "public+write+comment+upload", state: "", success: {
        credential, response in
        self.showAlertView("Dribbble", message: "oauth_token:\(credential.oauth_token)")
        // Get User
        var parameters =  Dictionary<String, AnyObject>()
        oauthswift.client.get("https://api.dribbble.com/v1/user?access_token=\(credential.oauth_token)", parameters: parameters,
            success: {
                data, response in
                let jsonDict: AnyObject! = NSJSONSerialization.JSONObjectWithData(data, options: nil, error: nil)
                println(jsonDict)
            }, failure: {(error:NSError!) -> Void in
                println(error)
            })
        }, failure: {(error:NSError!) -> Void in
            println(error.localizedDescription)
    })
}

My URL scheme

Dribbble app callback

1 个答案:

答案 0 :(得分:4)

您的URL Schemes设置为oauth-callback,而不是您预期的DribbbleChat2