简体   繁体   中英

How do I get params with oauth?

I have some confusion regarding Ruby and OAuth. Basically, this is what I'm doing:

@oauth.get('/foo.json?page=1')

However, for some reason outside of my understanding, the provider application is only receiving /foo.json , with the get params stripped.

I'm wondering if I'm missing something obvious here.

For OAuth 1.0a / RFC 5849, you may find my Signet OAuth implementation substantially easier to work with than the oauth gem. Documentation should be pretty straight-forward. OAuth 2.0 support is in progress and coming soon.

In your specific case, however, it's an issue with the design of the oauth gem. The first parameter to the get function is the path. Not the full request URI. They apparently assume that no one will ever use query parameters with that particular method? My guess is that the rationale here is that, since query parameters have to be signed, parsing the request URI reliably and merging the parameters in was more work than they wanted to do?

With apologies to the authors of that library, my recommendation is to simply avoid using it. It's just really poorly designed in my opinion. It's a good-enough implementation for some things, but if you're talking to an API that isn't using the corresponding OAuth server for Ruby, I don't think it does a very good job.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM