ios - OAuth swift : What "callback" URL for Dribbble app?

标签 ios swift oauth callback url-redirection

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

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

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

请问您能帮我将身份验证重定向到我的应用吗?

Redirect fail

这是我的回调 URL 函数

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

最佳答案

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

关于ios - OAuth swift : What "callback" URL for Dribbble app?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29464664/

相关文章:

ios - 如何保存用户快速按下按钮的日期?

ios - 如何在使用移动视觉人脸检测器时点击 UIView 进行捕获

Android oAuth 刷新 token 返回 null

android 和 ios 应用订阅 checkin react 原生

ios - 将参数传递给选择器操作

ios - libpd iOS 补丁地铁和延迟对象行为错误

swift - 如何对 SwiftLint 自定义规则使用正则表达式量词 * 和 +

python - 如何使 facebook 应用程序允许来自在本地服务器上运行的 django 项目的请求?

ssl - Google oauth SSL 证书错误

ios - 如何在 swift 中实现 "delete"通知