VonageClientSDKSilentAuth
冯纳哥验证静默认证使用移动电话的订购者身份模块(SIM)来证明用户的身份,无需任何用户输入。此SDK有助于即使在使用WiFi时也能通过蜂窝网络进行HTTP请求。
安装
Swift包管理器
import PackageDescription
let package = Package(
dependencies: [
.Package(url: "https://github.com/Vonage/verify-silent-auth-sdk-ios.git")
]
)
CocoaPods
pod 'VonageClientSDKSilentAuth'
兼容性
iOS 12+
使用方法
import VonageClientSDKSilentAuth
let client = VGSilentAuthClient()
client.openWithDataCellular(url: url, debug: true) { response in
if (response["error"]) != nil {
// Handle error
} else {
let status = resp["http_status"] as! Int
if (status == 200) {
// Handle response
} else {
// Handle error
}
}
}
响应
- 成功
当数据连接已经建立并且从URL端点接收到响应时
{
"http_status": string, // HTTP status related to the url
"response_body" : { // optional depending on the HTTP status
... // the response body of the opened url
},
"debug" : {
"device_info": string,
"url_trace" : string
}
}
- 错误
当数据连接不可用且/或发生内部SDK错误时
{
"error" : string,
"error_description": string,
"debug" : {
"device_info": string,
"url_trace" : string
}
}
潜在的错误代码:sdk_no_data_connectivity
、sdk_connection_error
、sdk_redirect_error
、sdk_error
。