swift OAuth2 OAuthSwifter错误-10
我需要使用Fitbit api,但我无法获得令牌。我收到的错误是操作无法完成。(OAuthSwiftError错误-10。) 我的代码:swift OAuth2 OAuthSwifter错误-10,swift,oauth-2.0,Swift,Oauth 2.0,我需要使用Fitbit api,但我无法获得令牌。我收到的错误是操作无法完成。(OAuthSwiftError错误-10。) 我的代码: let oauthswift = OAuth2Swift( consumerKey: "228Q6N", consumerSecret: "de8dc5301fbfb8ada6d0d327fb8395c2", authorizeUrl: "https://www.fitbit.com/oauth2/authorize",
let oauthswift = OAuth2Swift(
consumerKey: "228Q6N",
consumerSecret: "de8dc5301fbfb8ada6d0d327fb8395c2",
authorizeUrl: "https://www.fitbit.com/oauth2/authorize",
accessTokenUrl: "https://api.fitbit.com/oauth2/token",
responseType: "token"
)
let handle = oauthswift.authorize(
withCallbackURL: URL(string: "DemoSmartHeath://oauth-callback/fitbit")!,
scope: "sleep+settings+nutrition+activity+social+heartrate+profile+weight+location", state:"fitbit",
success: { credential, response, parameters in
print("credential : \(credential)")
print("response : \(response)")
print("parameters : \(parameters)")
},
failure: { error in
print(error.localizedDescription)
}
)
AppDelegate:
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
if (url.host == "oauth-callback") {
OAuthSwift.handle(url: url)
}
return true
}
有人能帮我吗