【发布时间】:2014-02-26 02:33:03
【问题描述】:
我正在将 coinbase 集成到 iOS 应用程序中,并且正在使用 Oauth2 进行身份验证。通过通常的工作流程后,我能够获得访问令牌。每当任何请求达到 401(到期时)时,我还通过调用以下命令尝试刷新我的访问令牌:
发布https://coinbase.com/oauth/token 数据:
grant_type=refresh_token&refresh_token=abcd1234&client_id=theclientid&client_secret=somesecretid
它可以工作一段时间,但有时会因请求响应而失败:
NSHTTPURLResponse: 0x15eb2730
{ URL: https://coinbase.com/oauth/token } { status code: 401, headers {
"CF-RAY" = "f67d477aae4052e-YYZ";
"Cache-Control" = "no-store";
Connection = "keep-alive";
"Content-Type" = "application/json; charset=utf-8";
Date = "Sun, 02 Feb 2014 15:14:14 GMT";
Pragma = "no-cache";
Server = "cloudflare-nginx";
"Set-Cookie" = "__cfduid=<some long alpha-numeric string>; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/; domain=.coinbase.com; HttpOnly";
Status = "401 Unauthorized";
"Strict-Transport-Security" = "max-age=31536000";
"Transfer-Encoding" = Identity;
Vary = "Accept-Encoding";
"Www-Authenticate" = "Bearer realm=\"Doorkeeper\", error=\"invalid_request\", error_description=\"The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.\"";
"X-Content-Type-Options" = nosniff;
"X-Frame-Options" = SAMEORIGIN;
"X-Rack-Cache" = "invalidate, pass";
"X-Request-Id" = "<some long alpha-numeric string>";
"X-Runtime" = "0.012066";
"X-Ua-Compatible" = "IE=Edge,chrome=1";
} }
以前有人遇到过这个错误吗?我假设请求 URL 总是正确的。我不确定为什么它会抱怨“缺少必需的参数”或“不支持的参数”。我还没有弄清楚失败的模式。希望那里的人可能以前见过这个。
【问题讨论】:
标签: authentication ios7 oauth-2.0