【发布时间】:2014-07-23 23:20:51
【问题描述】:
我正在为 OAuth 2.0 实现自己的身份验证框架。 据我了解,如果令牌已过期,服务器会发送 401。
我实现了 NSURLConnection 的委托
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
捕捉这些错误并刷新令牌。
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{
// refresh token and send it to server
if ([challenge previousFailureCount] > 0) {
// do something may be alert message
}
else
{
//refreshToken
}
}
但似乎我无法将令牌附加到 url。
【问题讨论】:
标签: ios oauth nsurlconnection nsurl