[GH-ISSUE #706] the closure for the authorize function callback is not being executed at all. #458

Closed
opened 2026-03-03 16:48:49 +03:00 by kerem · 2 comments
Owner

Originally created by @Monkey-X-Byte on GitHub (Apr 11, 2023).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/706

Description:

During my usage of OAuthSwift 2.2.0, the closure for the authorize function callback is not being executed at all.

let oauth = OAuth2Swift(consumerKey: appId, consumerSecret: appSecret, authorizeUrl: authorizeUrl, accessTokenUrl: accessTokenUrl, responseType: responseType, contentType: nil)
oauth.allowMissingStateCheck = true
#if os(iOS)
oauth.authorizeURLHandler = SafariURLHandler(viewController: viewController, oauthSwift: oauth)
#endif
self.oauth = oauth
_ = oauth.authorize(withCallbackURL: URL(string: callbackUrl), scope: scope, state: state, parameters: authorizeParameters, completionHandler: { result in
switch result {
case .success(let token):
completion(.success(token))
case .failure(let error):
completion(.failure(error))
}
})

OAuth Provider? (Baidu):

OAuth Version:

  • Version 1
  • [ x] Version 2

OS (Please fill the version) :

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

Installation method:

  • Carthage
  • [x ] CocoaPods
  • Swift Package Manager
  • Manually

Library version:

  • head
  • [ x] v2.2.0
  • v2.0.0
  • v1.4.1
  • other: (Please fill in the version you are using.)

Xcode version:

  • 11.4 (Swift 5.2)

  • 11.x (Swift 5.1)

  • 10.x (Swift 5.0)

  • [x ] other: (XCode14.3.)

  • objective c

Originally created by @Monkey-X-Byte on GitHub (Apr 11, 2023). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/706 ### Description: During my usage of OAuthSwift 2.2.0, the closure for the authorize function callback is not being executed at all. let oauth = OAuth2Swift(consumerKey: appId, consumerSecret: appSecret, authorizeUrl: authorizeUrl, accessTokenUrl: accessTokenUrl, responseType: responseType, contentType: nil) oauth.allowMissingStateCheck = true #if os(iOS) oauth.authorizeURLHandler = SafariURLHandler(viewController: viewController, oauthSwift: oauth) #endif self.oauth = oauth _ = oauth.authorize(withCallbackURL: URL(string: callbackUrl), scope: scope, state: state, parameters: authorizeParameters, completionHandler: { result in switch result { case .success(let token): completion(.success(token)) case .failure(let error): completion(.failure(error)) } }) ### OAuth Provider? (Baidu): ### OAuth Version: - [ ] Version 1 - [ x] Version 2 ### OS (Please fill the version) : - [x] iOS : - [ ] OSX : - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [ ] Carthage - [x ] CocoaPods - [ ] Swift Package Manager - [ ] Manually ### Library version: - [ ] head - [ x] v2.2.0 - [ ] v2.0.0 - [ ] v1.4.1 - [ ] other: (Please fill in the version you are using.) ### Xcode version: - [ ] 11.4 (Swift 5.2) - [ ] 11.x (Swift 5.1) - [ ] 10.x (Swift 5.0) - [x ] other: (XCode14.3.) - [ ] objective c
kerem closed this issue 2026-03-03 16:48:49 +03:00
Author
Owner

@phimage commented on GitHub (Apr 11, 2023):

let oauth = OAuth2Swift

retain it in memory

<!-- gh-comment-id:1504044653 --> @phimage commented on GitHub (Apr 11, 2023): let oauth = OAuth2Swift retain it in memory
Author
Owner

@Monkey-X-Byte commented on GitHub (Apr 12, 2023):

let oauth = OAuth2Swift

retain it in memory

You may not have seen that I mentioned the issue of retaining in memory. I'm encountering this issue while using OAuth2Swift in a SwiftUI application

<!-- gh-comment-id:1504849576 --> @Monkey-X-Byte commented on GitHub (Apr 12, 2023): > let oauth = OAuth2Swift > > retain it in memory You may not have seen that I mentioned the issue of retaining in memory. I'm encountering this issue while using OAuth2Swift in a SwiftUI application
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#458
No description provided.