[GH-ISSUE #297] Instagram authorizeWithCallbackURL never called #178

Closed
opened 2026-03-03 16:46:25 +03:00 by kerem · 3 comments
Owner

Originally created by @jjjeeerrr111 on GitHub (Oct 19, 2016).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/297

Description:

When trying to authenticate with Instagram, after typing in username and password I see successful login data but I am never redirected back to the app and the authorize completion block is never handled. Here is my code:

 @IBAction func loginButtonPressed(_ sender: UIButton) {
    let oauthswift = OAuth2Swift(
        consumerKey:    "***",
        consumerSecret: "****",
        authorizeUrl:   "https://api.instagram.com/oauth/authorize",
        responseType:   "code"
    )
    self.oauthswift = oauthswift
    //oauthswift.authorizeURLHandler = getURLHandler()
    let _ = oauthswift.authorize(
        withCallbackURL: URL(string: "http://54.213.72:8010/login")!,
        scope: "basic+public_content+follower_list+relationships", state:"INSTAGRAM",
        success: { credential, response, parameters in
            print("PRINT SUCCESS")
            print(credential.oauthToken)
        },
        failure: { error in
            print("PRINT ERROR")
            print(error.localizedDescription)
        }
    )

}

OAuth Provider (Twitter, Github, ..): Instagram

OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

  • iOS :
  • OSX :
  • TVOS :
  • WatchOS :

Installation method:

  • Carthage
  • CocoaPods
  • Manually

Library version:

  • head
  • v1.0.0
  • v0.6
  • other: (Please fill in the version you are using.)

Xcode version:

  • 8.0 (Swift 3.0)
  • 8.0 (Swift 2.3)
  • 7.3.1
  • other: (Please fill in the version you are using.)
  • objective c
Originally created by @jjjeeerrr111 on GitHub (Oct 19, 2016). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/297 ### Description: When trying to authenticate with Instagram, after typing in username and password I see successful login data but I am never redirected back to the app and the authorize completion block is never handled. Here is my code: ``` @IBAction func loginButtonPressed(_ sender: UIButton) { let oauthswift = OAuth2Swift( consumerKey: "***", consumerSecret: "****", authorizeUrl: "https://api.instagram.com/oauth/authorize", responseType: "code" ) self.oauthswift = oauthswift //oauthswift.authorizeURLHandler = getURLHandler() let _ = oauthswift.authorize( withCallbackURL: URL(string: "http://54.213.72:8010/login")!, scope: "basic+public_content+follower_list+relationships", state:"INSTAGRAM", success: { credential, response, parameters in print("PRINT SUCCESS") print(credential.oauthToken) }, failure: { error in print("PRINT ERROR") print(error.localizedDescription) } ) } ``` ### OAuth Provider (Twitter, Github, ..): Instagram ### OAuth Version: - [ ] Version 1 - [x] Version 2 ### OS (Please fill the version) : - [x] iOS : - [ ] OSX : - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [ ] Carthage - [x] CocoaPods - [ ] Manually ### Library version: - [ ] head - [x] v1.0.0 - [ ] v0.6 - [ ] other: (Please fill in the version you are using.) ### Xcode version: - [x] 8.0 (Swift 3.0) - [ ] 8.0 (Swift 2.3) - [ ] 7.3.1 - [ ] other: (Please fill in the version you are using.) - [ ] objective c
kerem 2026-03-03 16:46:25 +03:00
Author
Owner

@phimage commented on GitHub (Oct 19, 2016):

#295 just closed now but open when you creating this bug
before opening an issue read contribution guide (link available when you create an issue)

https://github.com/OAuthSwift/OAuthSwift/wiki/Instagram

then http://54.213.72:8010/login is your callback url, responsible to redirect to your app

<!-- gh-comment-id:254929079 --> @phimage commented on GitHub (Oct 19, 2016): #295 just closed now but open when you creating this bug before opening an issue read contribution guide (link available when you create an issue) https://github.com/OAuthSwift/OAuthSwift/wiki/Instagram then http://54.213.72:8010/login is your callback url, responsible to redirect to your app
Author
Owner

@jjjeeerrr111 commented on GitHub (Oct 20, 2016):

@phimage Im not sure what this means. Are you saying we cannot use the explicit method (server-side)?

<!-- gh-comment-id:254979306 --> @jjjeeerrr111 commented on GitHub (Oct 20, 2016): @phimage Im not sure what this means. Are you saying we cannot use the explicit method (server-side)?
Author
Owner

@phimage commented on GitHub (Oct 20, 2016):

I don't know but last time I test, that do not work (maybe just momentary)

Then your issue title "Instagram authorizeWithCallbackURL never called " is wrong...
are you talking about success and failure block...

Did you call "OAuthSwift.handle(url: url)" somewhere in your code and how you do it? (application scheme, url detection in webview, ...)

<!-- gh-comment-id:255040280 --> @phimage commented on GitHub (Oct 20, 2016): I don't know but last time I test, that do not work (maybe just momentary) Then your issue title "Instagram authorizeWithCallbackURL never called " is wrong... are you talking about success and failure block... Did you call "OAuthSwift.handle(url: url)" somewhere in your code and how you do it? (application scheme, url detection in webview, ...)
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#178
No description provided.