【问题标题】:After authenticating token(ACCESS GRANTED), doesn't redirect to Callback URL验证令牌(访问权限)后,不重定向到回调 URL
【发布时间】:2013-08-14 19:15:15
【问题描述】:

我正在使用simple-oauth1 项目在iOS app 中实现OAuth 1.0。我使用Withings api,所以我对simple-oauth1 进行了一些修改(比如消费者oauth 密钥、密钥、回调url ......)。我插入了

NSLog(request.URL.absoluteString);像下面的代码(它在 OAuth1Controller.m)

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
request navigationType:(UIWebViewNavigationType)navigationType
{   
    if (_delegateHandler) {
    NSString *urlWithoutQueryString = [request.URL.absoluteString componentsSeparatedByString:@"?"][0];
    NSLog(request.URL.absoluteString);
    if ([urlWithoutQueryString rangeOfString:OAUTH_CALLBACK].location != NSNotFound)
    {

使用该代码,

  1. 我点击OAuth login按钮然后webview显示登录页面。

  2. 我输入 ID/密码。

  3. Webview 显示帐户允许页面。我点击“允许”按钮。 (NSLog 显示http://oauth.withings.com/account/authorize?acceptDelegation=true&oauth_consumer_key=blahblah&oauth_nonce=blahblah&oauth_signature=blahblah&oauth_signature_method=HMAC-SHA1&oauth_timestamp=blahblah&oauth_token=blahblah&oauth_version=1.0&userid=blahblah

经过上述过程,webview 显示“ACCESS GRANTED”页面,其中 oauth_token= blahblah, oauth_verifier=blahblah。但它不会重定向到 Callback url,它停留在“ACCESS GRANTED”页面。

我已经这样做了大约 2 周,但我找不到答案为什么会发生这种情况。

【问题讨论】:

  • 您的 AUTH_URL、REQUEST_TOKEN_URL、API_URL 等使用了什么?我什至无法在 simple-oauth1 示例项目中显示登录页面。让它与 Fitbit 配合得很好......

标签: iphone ios api oauth withings


【解决方案1】:

我遇到了同样的问题(使用 php)。问题似乎是您必须在请求令牌步骤(第一步,而不是授权)提供 url 回调。

Withings API not redirecting to my callback url (PHP / OAuth)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-05
    • 2018-06-19
    • 2019-07-27
    • 2015-01-09
    • 1970-01-01
    • 2019-05-01
    • 1970-01-01
    • 2015-07-16
    相关资源
    最近更新 更多