[GH-ISSUE #184] No callback when calling authorizeWithCallbackURL #110

Closed
opened 2026-03-03 16:45:46 +03:00 by kerem · 4 comments
Owner

Originally created by @mohwaili on GitHub (Feb 16, 2016).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/184

On iOS 9 I get the callback from this function: authorizeWithCallbackURL
On iOS 8 I don't get anything back, no success nor error.

version oauthswift: 0.5.0

let oauthswift = OAuth1Swift(
            consumerKey: Router.consumerKey,
            consumerSecret: Router.consumerSecret,
            requestTokenUrl: Constants.URLs.RequestTokenURL,
            authorizeUrl: Constants.URLs.AuthorizeURL,
            accessTokenUrl: Constants.URLs.AccessTokenURL)
oauthswift.authorize_url_handler = WebViewController()

// RequestTokenURL = "https://publicapi.avans.nl/oauth/request_token"
// AuthorizeURL = "https://publicapi.avans.nl/oauth/login.php"
// AccessTokenURL = "https://publicapi.avans.nl/oauth/access_token"
// RedirectURL = "oauth-swift://oauth-callback/avans?dummy=1"
oauthswift.authorizeWithCallbackURL(NSURL(string: Constants.URLs.RedirectURL)!, success: { (credential, response, parameters) -> Void in
    print(credential.oauth_token)
    print(credential.oauth_token_secret)
}) { (error) -> Void in

}
Originally created by @mohwaili on GitHub (Feb 16, 2016). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/184 On iOS 9 I get the callback from this function: `authorizeWithCallbackURL` On iOS 8 I don't get anything back, no success nor error. version oauthswift: 0.5.0 ``` let oauthswift = OAuth1Swift( consumerKey: Router.consumerKey, consumerSecret: Router.consumerSecret, requestTokenUrl: Constants.URLs.RequestTokenURL, authorizeUrl: Constants.URLs.AuthorizeURL, accessTokenUrl: Constants.URLs.AccessTokenURL) oauthswift.authorize_url_handler = WebViewController() // RequestTokenURL = "https://publicapi.avans.nl/oauth/request_token" // AuthorizeURL = "https://publicapi.avans.nl/oauth/login.php" // AccessTokenURL = "https://publicapi.avans.nl/oauth/access_token" // RedirectURL = "oauth-swift://oauth-callback/avans?dummy=1" oauthswift.authorizeWithCallbackURL(NSURL(string: Constants.URLs.RedirectURL)!, success: { (credential, response, parameters) -> Void in print(credential.oauth_token) print(credential.oauth_token_secret) }) { (error) -> Void in } ```
kerem closed this issue 2026-03-03 16:45:46 +03:00
Author
Owner

@phimage commented on GitHub (Feb 16, 2016):

please read contributing guide for issue/bug https://github.com/OAuthSwift/OAuthSwift/blob/master/CONTRIBUTING.md

not working is not a good description for a bug

provide some code, version of oauthswift used, the authorization url handler used, provider/website to auth...

<!-- gh-comment-id:184848683 --> @phimage commented on GitHub (Feb 16, 2016): please read contributing guide for issue/bug https://github.com/OAuthSwift/OAuthSwift/blob/master/CONTRIBUTING.md not working is not a good description for a bug provide some code, version of oauthswift used, the authorization url handler used, provider/website to auth...
Author
Owner

@mohwaili commented on GitHub (Feb 16, 2016):

Sorry for not being very descriptive, I've updated the question.
It's weird that this issue only happens on iOS 8. On iOS 9 everything works fine.

<!-- gh-comment-id:184861317 --> @mohwaili commented on GitHub (Feb 16, 2016): Sorry for not being very descriptive, I've updated the question. It's weird that this issue only happens on iOS 8. On iOS 9 everything works fine.
Author
Owner

@mohwaili commented on GitHub (Feb 16, 2016):

I've found the solution for this issue:

on iOS 9 this delegate function in AppDelegate works: func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool

on iOS 8 I had to use this function:func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool

I think this issue can be closed.

<!-- gh-comment-id:184864676 --> @mohwaili commented on GitHub (Feb 16, 2016): I've found the solution for this issue: on iOS 9 this delegate function in AppDelegate works: `func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool` on iOS 8 I had to use this function:`func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool` I think this issue can be closed.
Author
Owner

@phimage commented on GitHub (Feb 17, 2016):

I reopen just to check doc/readme and demo app

<!-- gh-comment-id:185422736 --> @phimage commented on GitHub (Feb 17, 2016): I reopen just to check doc/readme and demo app
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#110
No description provided.