drewvergara / Foursquare-OAuth-iPhone

Hopefully, an easy way to authenticate with Foursquare APIv2 using OAuth for iPhone
8 stars 2 forks source link

Redirect URL issue #1

Open Mayankindianic opened 13 years ago

Mayankindianic commented 13 years ago

hi ,

Thanks for the helpful code.

I have one issue regarding to login functionality.We are getting token from request in webview did finish load method.

I have tested my app with 'http:www.google.com' as a callback url.But where first time i m trying to login it will not getting me redirect to app.and it will show google page.

because to get token we have condition to check callbak url is same as dummyURL(variable name here) but m getting "http:www.google.com/" and no token appended after it.

it is working with URL which is in code but try it out with some url which supports mobile view like google.

Please help.. :)

Burnsoft commented 13 years ago

this may help.

static NSString dummyRedirect = @"oauth_success/foursquare"; // add in your app call back URL here static NSString dummyFull =@"https://foursquare.com/oauth2/oauth_success/foursquare";// I added in another local variable as the callbackURL check didn't match. this is the callback URL and the fullURL form the actual returned data.

in the webViewDidFinishLoading change the fummyRedirect to dummyFull:

if ([dummyURL isEqualToString:dummyFull]) {

then the token will be stored accurately.

Another gotcha, if you are not seeing 2 objects in the splitURL array, then make sure the string it is splitting actually occurs in the string in the first place, I had a missing '/'