mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-26 12:45:52 +03:00
[GH-ISSUE #175] Nothing passed back on redirect #105
Labels
No labels
bug
cocoapod
duplicate
enhancement
feature-request
help wanted
help wanted
invalid
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/OAuthSwift#105
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @amruss on GitHub (Jan 22, 2016).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/175
Sorry ahead of time I'm new to IOS development.
Trying to connect to the Fitbit API and it authenticates fine but when it redirects back to my app nothing is passed back, or rather the code inside the closure never executes. Anyone know what I'm doing wrong?
oauthswift.authorizeWithCallbackURL( NSURL(string: "FitAlarmHelper://")!, scope: "profile", state: state, success: {
credential, response, parameters in
self.showTokenAlert(serviceParameters["name"], credential: credential)
print("done")
self.testFitbit2(oauthswift)
}, failure: { error in
print("error")
print(error.localizedDescription)
})
@phimage commented on GitHub (Jan 22, 2016):
Maybe the callback URL need a path to work
FitAlarmHelper://oauth
And just to be sure
@amruss commented on GitHub (Jan 22, 2016):
When I change the callback url to FitAlarmHelper://oauth or anything else I get this
Done Both of those:

@phimage commented on GitHub (Jan 22, 2016):
Did you define an application into https://dev.fitbit.com/apps/
and defined the callback url white list
mine is oauth-swift://oauth-callback/fitbit2 for the demo app
maybe remove uppercase also
@amruss commented on GitHub (Jan 22, 2016):
Yes I did!

@phimage commented on GitHub (Jan 22, 2016):
Set FitAlarmHelper://oauth if you use FitAlarmHelper://oauth
Set FitAlarmHelper://oauth-callback is you use FitAlarmHelper://oauth-allback
Fitbit need to match the full URL
@amruss commented on GitHub (Jan 22, 2016):
Hmm I did that, and i don't get an error when it redirects back to my app. But, it still doesn't execute the code in the closure. It acts just like when I used FitAlarmHelper://
@phimage commented on GitHub (Jan 22, 2016):
Have you see
OAuthSwift.handleOpenURLcalled? using a breakpoint intofunc application(application: UIApplication!, openURL url: NSURL!, sourceApplication: String!, annotation: AnyObject!)Is it your code ?
https://cloud.githubusercontent.com/assets/13264141/12503225/1419a1f2-c087-11e5-80d1-46bd71c1b0f7.png
This code is for FitAlarmHelper://oauth-callback only
@amruss commented on GitHub (Jan 22, 2016):
Okay it doesn't look like handleOpenURL is ever called
I took away the if statement to see if it was blocking it but it still wasn't called. Any idea what I'm doing wrong?
@phimage commented on GitHub (Jan 22, 2016):
hummm
Did you use a
authorize_url_handler? if you make iOS9 dev you can try theSFSafariViewControllerI just updated readme
ae4c47d4a7application(application:method signature, without any!because have a wrong method signature by copying readme could be the issueMaybe iOS9 must also declare URL scheme into LSApplicationQueriesSchemes, I expect not...
Declare targeted applications URL schemes in iOS9
In iOS 9 you must whitelist any URL schemes your app wants to query in Info.plist under the LSApplicationQueriesSchemes key (an array of strings)

@amruss commented on GitHub (Jan 23, 2016):
Thank you! I changed my AppDelegate and it fixed the issue. Appreciate the help!