-
Notifications
You must be signed in to change notification settings - Fork 77
Oauth2 Support #62
base: master
Are you sure you want to change the base?
Oauth2 Support #62
Conversation
…a the `auth_type` configuration setting, defaults to "oauth"
|
👍 Can we get this merged? |
|
Sorry for the delay. There are a couple bugs still need to be fixed, and the test suite needs to be updated. Will try to get to it asap! |
|
Nice. Please let me know if you need any help? |
|
+1 Any news on this? |
|
On "my todo very soon" list. Sorry again. |
|
Maybe you can point to what's missing/tests and we can pitch in some help? |
|
I'm going to try and get to it tomorrow. If not, I'll point you in the right direction. There were a couple bugs I've uncovered in this PR that need fixing. |
Data should be passed as parameters in the body of the request instead of converting it into query string params. Query string will work for smaller amounts of data, but errors arise when the query string becomes too long. For example this is often the case when requesting deltas using a long cursor string.
…th2-support Conflicts: dropbox-api.gemspec
Some notes: - I had to modify the logic in one Dropbox::API::Client#delta test because in my tests the last item returned by the delta API was actually the `test_dir` itself, not the file within it. I made the test flexible enough to handle either case: "file last" or "dir last". - Added a `type` key to connection.yml to indicate that the token provided is either "oauth2" or "oauth1". When ommitted, "oauth1" is assumed. - Alternatively ENV['AUTH']=oauth2 can be set when running the tests. This will override whatever is specified in connection.yml - I think ideally the spec would run all of the tests twice: once with an OAuth1 token and once with OAuth2, but that's a bit more than I have time for.
|
Okay very sorry for the crazy long delay. Fixed the remaining bugs and all tests are green for me. @marcinbunsch I think it's ready for a merge. Something you might want to do is run the tests with an OAuth1 token in connection.yml. I was only able run them with an OAuth2 token. |
|
Thanks! I'll set aside some time to go through this - I'll keep you posted! |
|
One thing: |
|
@joallard strange, it works for me without changing the consumer's endpoint. Are you hitting an exception when you run |
|
What I saw is that my token exchange returned an |
|
I ran that task from the |
|
Correct. Ha. I hadn't cloned the gem. |
|
The task does work. |
|
@disbelief Does the token exchange by default happen on the main endpoint? |
|
I'm relying on the ::OAuth2::Client.new(Dropbox::API::Config.app_key, Dropbox::API::Config.app_secret,
:site => Dropbox::API::Config.endpoints[endpoint],
:authorize_url => "#{Dropbox::API::Config.prefix}/oauth2/authorize",
:token_url => "#{Dropbox::API::Config.prefix}/oauth2/token")(https://github.com/unbox/dropbox-api/blob/oauth2-support/lib/dropbox-api/util/oauth2.rb#L12) I've been using this in production for close to a year without needing to do anything special. |
|
Actually no, the endpoint is a parameter to the method |
…box during token exchange
|
Ah yes you're right! Pushed an update. |
|
Excellent, and great work by the way! |
|
Thanks! Let me know if there's anything else required to get this PR merged. |
|
Hi guys! |
Originally was PR #47 but I needed to get it off of my master. See that PR for comments.