验证令牌(授予访问权限)后,不会重定向到回调 URL

问题描述 投票:0回答:1

我正在使用 simple-oauth1 项目在 iOS 应用程序中实现 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&用户id=blahblah

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

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

ios oauth withings
1个回答
1
投票

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

Withings API 未重定向到我的回调网址(PHP / OAuth)

© www.soinside.com 2019 - 2024. All rights reserved.