mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-26 04:35:56 +03:00
[GH-ISSUE #726] Twitter login not rediret #472
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#472
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 @joealzhou on GitHub (Dec 3, 2024).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/726
Description:
I didn't jump to the authorization page after logging in with Twitter for the first time, and I couldn't authorize it until I logged out of Safari and clicked the Twitter login button in the app again to open Safari. Is this normal?
self.oauthswift = OAuth1Swift(
consumerKey: TwitterKey,
consumerSecret: TwitterSecret,
requestTokenUrl: "https://api.x.com/oauth/request_token",
authorizeUrl: "https://api.x.com/oauth/authorize",
accessTokenUrl: "https://api.x.com/oauth/access_token"
)
let safariHandler = SafariURLHandler(viewController: self, oauthSwift: oauthswift!)
safariHandler.factory = { url in
return SFSafariViewController(url: url)
}
safariHandler.presentCompletion = { [weak self] in
self?.hud.hide(animated: false)
}
safariHandler.dismissCompletion = {
debugPrint("dismiss")
}
hud.show(animated: false)
oauthswift?.authorizeURLHandler = safariHandler
oauthswift?.authorize(withCallbackURL: TwitterAuthScheme, completionHandler: {[weak self] result in
switch result {
case .success(let (_, _, parameters)):
if let userid = parameters["user_id"] as? String, let userName = parameters["screen_name"] as? String {
debugPrint("login twitter userid: (userid) name: (userName)")
}
break
case .failure(let error):
self?.view.makeToast(error.localizedDescription)
}
})
OAuth Provider? (Twitter, Github, ..): Twitter
OAuth Version:
OS (Please fill the version) :
Installation method:
Library version:
Xcode version:
11.4 (Swift 5.2)
11.x (Swift 5.1)
[ *] 15.4 (Swift 5.5)
other: (Please fill in the version you are using.)
objective c