0

I'm implementing OAuth 1.0 in an iOS app using simple-oauth1 project. I use Withings api so I modified a little bit from simple-oauth1(like consumer oauth key, secret key, callback url...). And I inserted

NSLog(request.URL.absoluteString); like the following code(It's in 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)
    {

With that code,

  1. I tap the OAuth login button then webview shows login page.

  2. I enter ID/password.

  3. Webview shows account allow page. I tap "Allow" button. (NSLog shows 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)

After above process, webview shows "ACCESS GRANTED" page with oauth_token= blahblah, oauth_verifier=blahblah. But it doesn't redirect to Callback url, it stays at the "ACCESS GRANTED"page.

I've been doing this for about 2 weeks but I cannot find the answer why is this happening.

Marek
  • 3,555
  • 17
  • 74
  • 123
  • What did you use for your AUTH_URL, REQUEST_TOKEN_URL, API_URL, etc? I can't even get the login page to show up in the simple-oauth1 sample project. Got it working just fine with Fitbit... – bmueller Feb 03 '14 at 22:41

1 Answers1

1

I had the same issue (using php). The problem seems to be that you must provide a url callback at the request token step (first step, not the authorization).

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

Community
  • 1
  • 1
JRam13
  • 1,132
  • 1
  • 15
  • 25