Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth flow failed because of inconsistent state. #354

Closed
3DCoded opened this issue Apr 4, 2022 · 8 comments
Closed

Auth flow failed because of inconsistent state. #354

3DCoded opened this issue Apr 4, 2022 · 8 comments

Comments

@3DCoded
Copy link

3DCoded commented Apr 4, 2022

When I do Dropbox Auth Flow with SwiftUI, dropbox raises error, Auth flow failed because of inconsistent state.

@greg-db
Copy link
Contributor

greg-db commented Apr 4, 2022

Unfortunately, the Dropbox iOS Swift SDK does not officially support SwiftUI. I'll pass this along as a request for official support for that, but I can't promise if/when that would be done. (There's a thread here that may be helpful though.)

@3DCoded
Copy link
Author

3DCoded commented Apr 4, 2022

I tried the examples in the thread and they did not change the output. I am making a macOS app.

@greg-db
Copy link
Contributor

greg-db commented Apr 4, 2022

Thanks for following up. I'm sorry to hear that didn't help. I'll follow up here if/when the team officially adds support for SwiftUI.

@3DCoded
Copy link
Author

3DCoded commented Apr 4, 2022

I don't think this is a problem with SwiftUI, as the URL Dropbox redirects to is: db-<APP KEY>://2/token?code=<CODE>&state=<STATE>, and not db-<APP KEY>://2/token?access_token=<ACCESS TOKEN>

@3DCoded
Copy link
Author

3DCoded commented Apr 4, 2022

What format of redirect URI does SwiftyDropbox expect?

@3DCoded
Copy link
Author

3DCoded commented Apr 4, 2022

Is there a way to manually parse the URL and get the Access Token?

@3DCoded
Copy link
Author

3DCoded commented Apr 5, 2022

I found a workaround for now: I modify the url to set response_type=token and then I manually parse the URL and create a Dropbox Client from the Access Token.

@3DCoded 3DCoded closed this as completed Apr 5, 2022
@greg-db
Copy link
Contributor

greg-db commented Apr 5, 2022

Thanks for following up and clarifying. I'm glad to hear you got this working.

For reference though, unless SwiftUI is somehow complicating this, you shouldn't have to parse the URLs yourself. As long as you implement the authorization flow as shown in the documentation here, using authorizeFromControllerV2 (which is preferred, or authorizeFromController, which is deprecated, but not both), the SDK should handle this all for you automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants