我无法登录使用Oath-2的应用程序并获得unsupported_grant_type错误。我正在使用Alamofire发布登录数据但无法成功。我在哪做错?我无法解决问题。
func sendFeedback()
func sendFeedback(){
let parameters = [
"UserName": username_textfield.text! as String,
"Password": password_textfield.text! as String,
"grant_type": "Password" as String,
]
Alamofire.upload(multipartFormData: { multipartFormData in
for (key, value) in parameters {
multipartFormData.append((value.data(using: .utf8))!, withName: key)
}}, to: "http://192.168.100.5:84/Token", method: .post, headers: ["Authorization": "auth_token"],
encodingCompletion: { encodingResult in
switch encodingResult {
case .success(let upload, _, _):
upload.response { [weak self] response in
guard self != nil else {
return
}
debugPrint(response)
// self?.view.hideToastActivity()
self?.view.makeToast(message: "Send Successfull. !!!")
}
upload.uploadProgress(queue: DispatchQueue(label: "uploadQueue"), closure: { (progress) in
})
case .failure(let encodingError):
print("errorss:\(encodingError)")
}
})
}
我的状态代码为400.如何解决此问题?