我试图对MapMyFitness
API(Oauth2)做一些请求。MapMyFitness API请求上的错误403
我可以得到我的Authorization Code
与oauth2标识,但现在我需要请求一些路线。
这里是要求:
Alamofire.request(self.oauthClient.baseURL() + "workout/",
method: .get,
parameters: nil,
headers: authorizationHeader
)
.validate()
.responseData { [weak self] (response) in
switch response.result {
case .success(let data):
do {
let jsonResponse = try JSON(data: data)
success(items);
self?.isLoading = false;
} catch {
self?.isLoading = false;
failed(nil)
}
break;
case .failure(let error):
print(error);
self?.isLoading = false;
failed(error)
break;
}
}
在这里头是授权这样的代码:
"Authorization": "Bearer ***********************************"
Here is the doc about the route API : https://developer.underarmour.com/docs/v71_Workout
Alamofire错误:
responseValidationFailed(Alamofire.AFError.ResponseValidationFailureReason.unacceptableStatusCode(403))
我失去了什么? Thx
你可以分享你的代码制作的OAuth2授权?你是用swift3写的吗?我试图找到swift3的任何教程,但没有什么在那里:/ – pawisoon
@pawisoon提出您的代码和问题的问题,我会尽力回答你。 – Makaille
here:http://stackoverflow.com/questions/43524410/oauth2-for-mapmyrun-using-swift-3 – pawisoon