cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in hearing how one of our Community members uses Dropbox for sailing trips? Read all about it here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: authorizeFromControllerV2 error when authorizing

authorizeFromControllerV2 error when authorizing

Ditza
Explorer | Level 3
Go to solution

I am trying to switch from a long-life token to a short one.
I am using SwiftyDropbox SDK version 7.0.1

I am following the instructions on the readme tutorial on GitHub: 

https://github.com/dropbox/SwiftyDropbox/tree/7.0.1 

In the "Begin authorization flow" section,
I change the function to:

authorizeFromControllerV2

Now when I press on "Allow" in dropbox permission pop I am getting an error:

"Error Authorizining App. An error occurred authorizing your app. Please try again"

I saw this post and added SceneDelegate file to my project and added this code inside:

 

 

    func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
        if let url = URLContexts.first?.url {
            
            let oauthCompletion: DropboxOAuthCompletion = {
              if let authResult = $0 {
                  switch authResult {
                  case .success:
                      print("Success! User is logged into DropboxClientsManager.")
                  case .cancel:
                      print("Authorization flow was manually canceled by user!")
                  case .error(_, let description):
                      print("Error: \(String(describing: description))")
                  }
              }
            }
            DropboxClientsManager.handleRedirectURL(url, completion: oauthCompletion)
            
        }
    }

 

 

It didn't help. 
When I click on cancel instead of Allow I am getting back to the AppDelegate file.

 

 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

Yes, scoped apps can still use the old authorizeFromController method. It will just use the default scopes set for the app in the App Console.

View solution in original post

3 Replies 3

Greg-DB
Dropbox Staff
Go to solution

Have you migrated your app registration to scopes yet? You can do so via the "Permissions" tab on the app's page on the App Console. You'll need to do so before you can use the new authorizeFromControllerV2 method. (Apologies for the generic error message!)

Ditza
Explorer | Level 3
Go to solution

Sorry, I missed this step,
If I do so I still can use the old version of the code?

Greg-DB
Dropbox Staff
Go to solution

Yes, scoped apps can still use the old authorizeFromController method. It will just use the default scopes set for the app in the App Console.

Need more support?