我正在制作一个使用 OAuthSwift 进行 Dribbble 登录的应用程序,一切顺利(当然我在 Dribbble 开发者页面上设置了应用程序并且我有我的客户端 ID 和密码)。
但是当它询问用户是否接受权限时,回调不起作用。
我做了我的 URL 回调“DribbbleChat2://oauth-callback”,我在 Xcode Infos 中做了一个 URL 方案“oauth-callback”
请问您能帮我将身份验证重定向到我的应用吗?
这是我的回调 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)
})
}
最佳答案
您的 URL Schemes
设置为 oauth-callback
,而不是您预期的 DribbbleChat2
关于ios - OAuth swift : What "callback" URL for Dribbble app?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29464664/