[GH-ISSUE #489] Safari cannot open the page because the address is invalid Question #323

Closed
opened 2026-03-03 16:47:41 +03:00 by kerem · 3 comments
Owner

Originally created by @Jingyi-li on GitHub (Sep 4, 2018).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/489

Description:

Hi,
I try to get authorize from dropbox. I can reach the login page but when I try to allow the access to its own folder and inside to my dropbox, there is an error show up "Safari cannot open the page because the address is invalid".

Sorry I am a new coder I still not familier with xcode. My friend told me that token need a server? But I saw the demo seems not need it. Sorry I try to read the readme.md, and I cannot full understand it. It will be very appreciated that you can help me.

Thanks

 func doOAuthDropbox(){
        
        let oauthswift = OAuth2Swift(consumerKey: my.consumerKey,
                                     consumerSecret: my.consumerSecret,
                                     authorizeUrl: "https://www.dropbox.com/oauth2/authorize",
                                     accessTokenUrl: "https://api.dropbox.com/1/oauth2/token",
                                     responseType: "token")
        
        self.oauthswift = oauthswift
        
        oauthswift.authorizeURLHandler = SafariURLHandler(viewController: self, oauthSwift: oauthswift)
        

        let _ = oauthswift.authorize(withCallbackURL: URL(string: "FTPtester://oauth-callback/dropbox")!,
                            scope: "", state:"DROPBOX",
                            success: { credential, response, parameters in

                                print(credential.oauthToken)
                                print(parameters)
                                // TODO: Save credential in keychain
                                // TODO: Create Dropbox provider using urlcredential
        }, failure: { error in
            print(error.localizedDescription)
        }
        )

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

OAuth Version:

  • Version 1
  • [x ] Version 2

OS (Please fill the version) :

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

Installation method:

  • Carthage
  • CocoaPods
  • Manually

Library version:

  • head
  • [x ] v1.2.2
  • v1.2 (Swift 4.0)
  • v1.0.0
  • v0.6
  • other: (Please fill in the version you are using.)

Xcode version:

  • [x ] 9.4

  • 9.0 (Swift 4.0)

  • 9.0 (Swift 3.2)

  • 8.x (Swift 3.x)

  • 8.0 (Swift 2.3)

  • 7.3.1

  • other: (Please fill in the version you are using.)

  • objective c

Originally created by @Jingyi-li on GitHub (Sep 4, 2018). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/489 ### Description: Hi, I try to get authorize from dropbox. I can reach the login page but when I try to allow the access to its own folder and inside to my dropbox, there is an error show up "Safari cannot open the page because the address is invalid". Sorry I am a new coder I still not familier with xcode. My friend told me that token need a server? But I saw the demo seems not need it. Sorry I try to read the readme.md, and I cannot full understand it. It will be very appreciated that you can help me. Thanks ``` func doOAuthDropbox(){ let oauthswift = OAuth2Swift(consumerKey: my.consumerKey, consumerSecret: my.consumerSecret, authorizeUrl: "https://www.dropbox.com/oauth2/authorize", accessTokenUrl: "https://api.dropbox.com/1/oauth2/token", responseType: "token") self.oauthswift = oauthswift oauthswift.authorizeURLHandler = SafariURLHandler(viewController: self, oauthSwift: oauthswift) let _ = oauthswift.authorize(withCallbackURL: URL(string: "FTPtester://oauth-callback/dropbox")!, scope: "", state:"DROPBOX", success: { credential, response, parameters in print(credential.oauthToken) print(parameters) // TODO: Save credential in keychain // TODO: Create Dropbox provider using urlcredential }, failure: { error in print(error.localizedDescription) } ) ``` ### 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.2.2 - [ ] v1.2 (Swift 4.0) - [ ] v1.0.0 - [ ] v0.6 - [ ] other: (Please fill in the version you are using.) ### Xcode version: - [x ] 9.4 - [ ] 9.0 (Swift 4.0) - [ ] 9.0 (Swift 3.2) - [ ] 8.x (Swift 3.x) - [ ] 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:47:42 +03:00
Author
Owner

@phimage commented on GitHub (Sep 12, 2018):

The server is the provider, so for you Dropbox

You must debug to see what happens

Maybe you did not registered FTPtester url scheme in your project configuration) see readme
https://github.com/OAuthSwift/OAuthSwift#setting-url-schemes

<!-- gh-comment-id:420535746 --> @phimage commented on GitHub (Sep 12, 2018): The server is the provider, so for you Dropbox You must debug to see what happens Maybe you did not registered FTPtester url scheme in your project configuration) see readme https://github.com/OAuthSwift/OAuthSwift#setting-url-schemes
Author
Owner

@Jingyi-li commented on GitHub (Sep 13, 2018):

Thanks solve the problem

<!-- gh-comment-id:420892272 --> @Jingyi-li commented on GitHub (Sep 13, 2018): Thanks solve the problem
Author
Owner

@olcayertas commented on GitHub (Sep 28, 2018):

What is the application name here?
Is'nt it my custom url scheme like: myapp://bla-bla?
Should I just use myapp?

<!-- gh-comment-id:425430978 --> @olcayertas commented on GitHub (Sep 28, 2018): What is the application name here? Is'nt it my custom url scheme like: `myapp://bla-bla`? Should I just use `myapp`?
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#323
No description provided.