Reputation: 51
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,
I tap the OAuth login
button then webview shows login page.
I enter ID/password.
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.
Upvotes: 0
Views: 768
Reputation: 1132
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)
Upvotes: 1