【发布时间】:2019-03-11 02:34:38
【问题描述】:
我在使用 OAuthSwift 和 Dexcom API (https://developer.dexcom.com/authentication) 获取令牌然后发出请求时遇到问题。
这是我当前用于通过单击链接到登录和重定向返回的按钮来授权用户使用服务的代码。
import UIKit
import OAuthSwift
class ViewController: UIViewController {
// UI Elements
@IBOutlet weak var resultLabel: UILabel!
@IBAction func authorizeTapped(_ sender: Any) {
authorizeDexcom()
}
var oauthswift: OAuth2Swift = OAuth2Swift(
consumerKey: "***",
consumerSecret: "***",
authorizeUrl: "https://sandbox-api.dexcom.com/v2/oauth2/login?",
accessTokenUrl: "https://sandbox-api.dexcom.com/v2/oauth2/token",
responseType: "code"
)
// Dexcom Test Functions
func authorizeDexcom() {
oauthswift.allowMissingStateCheck = true
oauthswift.authorizeURLHandler = SafariURLHandler(viewController: self, oauthSwift: oauthswift)
guard let rdURI = URL(string: "***") else {
return
}
oauthswift.authorize(withCallbackURL: rdURI,
scope: "offline_access",
state: "",
success: { credential, response, parameters in
print("SUCCESS")
print(credential.oauthToken)
}, failure: { error in
print(error.localizedDescription)
}
)
}
有人可以指导我下一步应该做什么或我应该如何在这里提出请求吗?当我运行我的应用程序并单击调用授权功能的按钮时,我得到了似乎是在控制台中打印的令牌,但后面跟着几行“获取输出帧失败,状态 8196”,这导致我相信授权过程没有正确完成。
我查看了以下资源,但还没有发现任何有用的信息。
- get output frames failed, state 8196
- I'm testing login authentication in swift using firebase and getting errors get output frames failed, state 8196
- Borring SSl iOS 12
- OAuthSwift (1) connection
感谢您的帮助。
【问题讨论】: