[GH-ISSUE #372] please help, how i can use sfsafariviewcontroller with oauthswift using oauth2swift in xcode 8.3 and swift 3 #239

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

Originally created by @oshitub123 on GitHub (May 11, 2017).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/372

Description:

OAuth Provider (Twitter, Github, ..):

OAuth Version:

  • Version 1
  • [x ] Version 2

OS (Please fill the version) :

  • 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

Originally created by @oshitub123 on GitHub (May 11, 2017). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/372 ### Description: ### OAuth Provider (Twitter, Github, ..): ### 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 closed this issue 2026-03-03 16:46:58 +03:00
Author
Owner

@oshitub123 commented on GitHub (May 11, 2017):

i have delagate like this

class ViewController: UIViewController,UIApplicationDelegate,UIWebViewDelegate,SFSafariViewControllerDelegate{

<!-- gh-comment-id:300825184 --> @oshitub123 commented on GitHub (May 11, 2017): i have delagate like this class ViewController: UIViewController,UIApplicationDelegate,UIWebViewDelegate,SFSafariViewControllerDelegate{
Author
Owner

@oshitub123 commented on GitHub (May 11, 2017):

and use the next code

but not function

 oauthswift = OAuth2Swift(
        consumerKey:    "da0a78c40b5e4a2eb38d5ea03f32rw839feacf",
        consumerSecret: "",
        authorizeUrl:"https://accounts.spotify.com/authorize",
        responseType:"token"
   )
    let safari = SafariURLHandler( viewController: self ,oauthSwift:self.oauthswift!)
    safari.delegate = self
    oauthswift?.authorizeURLHandler = safari
    
    
    oauthswift?.authorize(withCallbackURL: "TestOauth://testoauth/twitte", scope: "", state: "", success: { (credential, response,parameters) in
        print(" token :\(credential.oauthToken)")
        print(credential.oauthVerifier)
        print(parameters)
        self.aux1token = credential.oauthToken
        self.defaults.set(self.aux1token, forKey: "pk")
        self.retrieve()

        
    }, failure: { error in
        print(error.localizedDescription)
    }

)

<!-- gh-comment-id:300825552 --> @oshitub123 commented on GitHub (May 11, 2017): and use the next code but not function oauthswift = OAuth2Swift( consumerKey: "da0a78c40b5e4a2eb38d5ea03f32rw839feacf", consumerSecret: "", authorizeUrl:"https://accounts.spotify.com/authorize", responseType:"token" ) let safari = SafariURLHandler( viewController: self ,oauthSwift:self.oauthswift!) safari.delegate = self oauthswift?.authorizeURLHandler = safari oauthswift?.authorize(withCallbackURL: "TestOauth://testoauth/twitte", scope: "", state: "", success: { (credential, response,parameters) in print(" token :\(credential.oauthToken)") print(credential.oauthVerifier) print(parameters) self.aux1token = credential.oauthToken self.defaults.set(self.aux1token, forKey: "pk") self.retrieve() }, failure: { error in print(error.localizedDescription) } )
Author
Owner

@phimage commented on GitHub (May 13, 2017):

see my first comment
https://github.com/OAuthSwift/OAuthSwift/issues/366

same apply
I will not help If you doesn't read me
then read also https://github.com/OAuthSwift/OAuthSwift/blob/master/.github/CONTRIBUTING.md

<!-- gh-comment-id:301234756 --> @phimage commented on GitHub (May 13, 2017): see my first comment https://github.com/OAuthSwift/OAuthSwift/issues/366 same apply I will not help If you doesn't read me then read also https://github.com/OAuthSwift/OAuthSwift/blob/master/.github/CONTRIBUTING.md
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#239
No description provided.